ror-practices-merb-practices

I will just write down my most recent gotchas here, hoping that others do the same and someone organizes once patterns emerge :)

Redirects

Redirect_to in RoR becomes redirect in Merb, redirect in Merb requires a String, not a Hash. To solve this, use url(...). Example:

redirect url(:controller => 'comment', :action => 'new')

Partials

Rendering partials in Merb uses its own function call, partial. Partial can take a symbol for an action which is in the controller’s view folder or a string if you wish to fully qualify the location of the partial. For the classical rendering of a shared _form.html.erb between ‘new’ and ‘edit’ CRUD operations:

partial :form
To specify variables which will be accessible as local in the partial:

partial "/shared/foo_rendering", :foo => bar

Edit Page | History | Version: