Dec 25, 2008

Rails: ActionController#render become more smarter

Pratik Naik pushed a series of commits to make ActionController#render more easy to use.

1. It will recognize actions.

# Instead of render(:action => 'other_action')
render('other_action')

2. It will recognize templates.

# Instead of render(:template => 'controller/action')
render('controller/action')

3. It will recognize a file path.

# Instead of render(:file => '/Users/lifo/home.html.erb')
render('/Users/lifo/home.html.erb')

4. It will recognize a symbol. So in your create action you can just write 'render :new' when model save failed!

No comments:

Post a Comment