ruby on rails - What is the difference between 'form_for @ecard' and 'form_for :ecard'? -


I have applied a restfull controller with all the right actions and scenes. It currently works entirely with a new_html.erb view which uses a form_for such as structure:

  
for the form Do F | & Gt%;

After watching some tutorials, I saw that people also use the structure:

  <% form_for: ecard do | F | & Gt%;  

It seems logical .. but when I try to use form_for : ecard do | F | %> As a result the post goes to a different action then form_for @chard do | Using f %> ..

-> HTML Results: -> HTML Results: So I'm wondering what I'm missing, the difference in use: ecard and @ecard are obvious when i look at the generated html I am still wondering what is the reason behind it! Can anyone please explain what is the difference and what structure do I want to use? This or the

Marco,

This is the answer given on this site:

I hope that clears it.


Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -