Frequently Asked Questions
Q. How do I reference the controller/action name within a controller/view?
A. params[:controller] or params[:action]. If you have a namespaced controller it will print out like namespace/controller.
Q. I’m getting undefined method scaffold. I’ve just upgraded to Rails 2.
A. http://tpope.us/rubyonrailsfaq.html
Q. I’m getting undefined method start_form_tag. I’ve just upgraded to Rails 2.
A. start_form_tag has been deprecated as of Rails 2.0. The correct syntax is to now use a block:
<% form_for @object do |@f| %> <%= render :partial => "form" %> <%= @f.submit "Create" %> <% end %>
Alternatively, use form_tag and specify a :controller and :action parameter if necessary.
What are these .html.erb files my application is generating? What happened to .rhtml?
.rhtml has been dropped in favour of .html.erb because it is more readable and allows you to easily define formats. The correct extension now is format.builder, html.erb.
