开发者

form_tag isn't working when upgraded to rails 3.0.7 --> 3.1

Just upgraded to rails 3.1 and now my form_tag doesn't work anymore, I don't get any errors at all?

    <% form_tag({:action => 'search'开发者_如何学C}, :remote => true) do %>
        <%= select_tag "prod_id", options_for_select(["-"]) %>
        ...
    <% end %>

Have something dramatically changed so I need to change my code?

Thanks in advance


Code blocks in your views (like form_for, for instance) now need to use the <%= %> syntax instead of <% %>.

Change the first line of your code to look like this:

<%= form_tag({:action => 'search'}, :remote => true) do %>

and you should be good to go.

As a note, I think this change actually came about in one of the Rails 3.0 betas. Check out http://asciicasts.com/episodes/208-erb-blocks-in-rails-3 for a bit of documentation on it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜