Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between <%= form_tag and <% form_tag

I am having a problem in Rails .. I might be a silly question, but pls give me suggestions.

What is the difference between:

  <%= form_tag("path", :method=>'post') do %>
  <% end %>

and:

  <% form_tag("path", :method=>'post') do %>
  <% end %>

Please give me some suggestions.

like image 624
useranon Avatar asked Dec 15 '25 12:12

useranon


1 Answers

They do the same thing. The former is the Rails 3 syntax, the latter targets Rails versions < 3.

Rails 3 still support the syntax without the leading equal but it currently prints a deprecation warning. The Rails 2 syntax will be removed in Rails 3.1.

like image 111
Simone Carletti Avatar answered Dec 18 '25 09:12

Simone Carletti



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!