RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

Inherited Resources is scopes and responder fluent

Inherited Resources is growing in a fast pace and now it supports named scopes and ActionController::Responder from Rails 3.0 was backported! And be sure to let a comment if you agree or not with the new proposed DSL.

Comments

Could you do a comparison with http://github.com/giraffesoft/resource_controller/tree/master ? I know a lot of people use that.

Hey Peter!

Inherited Resources borrowed some ideas from Resource Controller, that said, all the end_of_association_chain, collection, url and helper methods are available on Inherited Resources as well.

Besides, Inherited Resources has better singleton support (including the begin_of_association_chain method), allows nested belongs to (task belongs to project which belongs to company) and the newly added scope support. One of the features that people also like is that all flash messages are handled through I18n, including fallbacks. Some of the ideas in Rails 3 respond_with came from Inherited Resources (including part of the test suite ;)).

The main difference though, between both is the DSL. Inherited Resources requires that you overwrite your actions, instead of class blocks:

def update @project = Project.find(params[:id]) @project.something_special! update! # alias to super end

While the similar in resource controller would be:

update.before do @project = Project.find(params[:id]) @project.something_special! end

<a href=”http://groups.google.com/group/boston-rubygroup/browse_thread/thread/40dd26a59dc5065c/74be293682dd708a?q=boston+ruby+”inherited_resources”#74be293682dd708a”>The discussion in Boston.rb</a> and both plugins README are a good source of comparison as well. :)

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in