garybernhardt / raptor

An experimental web framework.
367 stars 30 forks source link

Implement Inferables #21

Closed compactcode closed 12 years ago

compactcode commented 12 years ago

I was playing around with raptor recently and tried hooking it up to a Sequel backed.

Unfortunately I was unable to directly use sequel as a record because the sequel new and create methods expect a 'values' parameter to be passed (Instead of 'params'). In order to get it working I had to create an adapter to convert the incoming 'params' to 'values'.

Looking at the project readme it seems like Inferables might be the solution to this problem. Not sure if your still working on raptor but if you have any advice for implementing Inferables or another solution I'm happy to take a crack at it.

tcrayford commented 12 years ago

Eventually, there will probably be a custom way of adding your own dependency injectors. I don't think we have a good way to do that yet, but feel free to send a pull request.

This feels to me like something we can add as a constant inside each resource, or maybe as a seperate list to Raptor::App.new(). @garybernhardt, thoughts?

garybernhardt commented 12 years ago

It could certainly go in the resource. I'm still torn about whether or not resources as "generic buckets of parts" is the right thing, though. I see that @compactcode has broken his resource into separate presenter/record/route files, so I suspect he's torn about this as well. :)

compactcode commented 12 years ago

Although my example code was slapped together without tests, test performance was one of the key reasons for me to split the resource up. In particular, I was thinking about being able to test my presenters/views without loading the sequel gem.

garybernhardt commented 12 years ago

Done: injectables (formerly called inferables) are now in master.