RailsCasts Pro episodes are now free!
Learn more or hide this
What do you think about resource_controller http://www.akitaonrails.com/2008/1/25/easy-restful-rails-screencast
thanks for this episode. It's a great way to cover the RESTful controllers for standard Model access in a nice and dry way.
First of all I think this is a beautiful plugin. I feel though that it is perhaps clever to a fault. Thats adding 572k to my project so I *cannot see my controllers? Even if I were to stick completely to the REST convention I would rather run 'scaffold' and move on. That being said I am happy to see people taking REST this seriously.
Any tips on using this with RESTful controllers that do not control their own model (i.e. a sessions controller for User authentication)? Or would you recommend not using m_r in that case?
@Matt Hooks: The whole point of make_resourceful is to dry up the default model CRUDS, so if you're doing anything other than that, I'd say typing the SessionsController out by hand would make sense.
I follow your blog and watched the last video u made about resource_controller and rails 2.0.
It was very good, but I think it would have been better if u used:
make_resourceful vs resource_controller
haml vs erb
these 2 plugins simplify the development of web apps, please take a look at them and make another great video!!
thanks ryan for this great screencast, u r still the leader of screencasts!!!
I am not Akia.
@REST, I wasn't very familiar with resource_controller, but taking another look at it now it looks very good and in some ways looks more powerful and concise than resource_controller. I should have mentioned it in the screencast as an alternative, thanks for pointing it out.
@sintaxi, in some ways I agree with you. Trying to DRY up the controller can often lead to a solution that's too clever for its own good. But at the same time I think it can lead to more concise and readable code as long as you use it properly and understand the conventions. Instead of thinking about it hiding the controller actions, think of it as highlighting the exceptions to the conventions, which is often more important.
Or there's the original resources_controller
I think Hampton rules, HAML is gold and from what I am seeing make_resourceful looks really nice. For my current project I'm using resource_controller, I really like the new scaffolding which is HAML based if you have HAML installed, I also like the fact my controllers are completely empty of code. Farther more RC is really hackable, I managed to write a new base class that gives me base level handling for my xhr calls, (which is not handled by default)
I don't think its a case of one plugin is better than the other, as hampton says: "two different approaches, with different strengths"
As usual, your screencasts are great.
PS. can you make this text area a bit bigger, its hard to type in long comments :)
Actually it wasn't me that posted the first message :-) Anyway. make_resourceful is a tremendous plugin and it came first. Caitlin definitely has the edge. James Golick used to contribute to this plugin but decided to make his own because of his disagreements with some of the concepts of the original project. Alas, the 'big' block around everything for one.
Now, to me, the biggest benefit of resource_controller over make_resourceful are the view helpers that makes your view set virtually independent of nesting depth. If you're working with polymorphic associations, this is a must have.
Ryan, thanks for yet another insightful cast. They are even great for brushing up on TextMate tricks. I guess you're typing ^L when typing a hash pair for clarity, however I thought it wouldn't hurt to mention that this can even more easily be achieved by typing a colon followed by pressing 'tab'.
I went through akita's screen cast and realized how powerful resource_controller was but had the sick feeling of how heavy the plugin was, excluding the app that comes bundled! I just found this screen cast and converted a project from r_c to m_r. I am happy with it as a much smaller plugin that hides most of the same work. The only thing I can't figure out is how to override the actual behavior of a rest method for associating objects like comments to posts. Response_for is only concerned with rendering. Where is the hook for the behavior?
I'm a bit curious about testing. If you where to use behavior driven development, you would want to describe the behavior of your controllers.
Now I know you should not test the make_resourceful functionality because that is bound to be well tested already.
I guess I can write tests for behavior that differs from the vanilla REST setup, but then I'm just assuming that I use make_resourceful in the controller, not testing that behavior...
In the end I guess it's just about rubust code, if it does not break when you make changes and update the tests... then all is fine.
Are there someone else that have given this some thought?
Of course, no controller only uses the defaults. So make_resourceful can be massively customized, while still keeping your controllers trim and readable.
This is a good plugin to know about.
As the video mentions you should use the plugin only if you have a conventional controller. I rarely have conventional controllers and I'd like to see a video on drying up those.
It wouldn't be a short video as there are many cases to consider, but I expect there are patterns that could be shown. Maybe there should be a book on the subject.
Pluggins are always what make a website work
comments are very good friends thank you.
Thanks. U are the best. I like this text. Hello from Russia =)
First sign in through GitHub to post a comment.