views:

48

answers:

1

Why does the following code work in Rails 3 rc2 but not in Rails 3?

  <%= form_for  :product, Product.new, 
                :url  => products_path()  do |f| %>
      <%= f.text_field :name %>
  <% end %>

I have formtastic installed but when I took it out I get the same result. I started this project before Rails3beta 1. Should I have changed something when rails initializes? I am a bit lost.

  <%= form_tag  products_path()  do %>

  <% end %>

Form tag works great though.

Thanks in advance, Dave

A: 

When I tried your code in Rails 3 it works smoothly with just a little warning:

DEPRECATION WARNING: Using form_for(:name, @resource) is deprecated. 
Please use form_for(@resource, :as => :name) instead.

If I remember it well, this change was introduced before rc2 so it would not be related to your problem. And it's just a warning :-)

UPDATE: what do you mean by "blank"?

(As I'm new to StackOverflow I cannot comment on your question...)

pawien