Default views in Rails 3.0 with custom resolvers

Posted . Visible to the public.

It is common in Rails 3.0 applications that you want to provide default views for a group of controllers. Let’s say you have a bunch of controllers inside the Admin namespace and you would like each action to fallback to a default template. So if you are rendering the index action for Admin::PostsController and “app/views/admin/posts/index.html.*” is not available, it should then render “app/views/admin/defaults/index.html”.

Since Rails 3.0, we have a new abstraction called resolvers that holds the logic to find a template.

Last edit
Keywords
rails, rails3, makandra
License
Source code in this card is licensed under the MIT License.
Posted by Lexy to makandra dev (2011-04-04 19:53)