I implemented a restfull controller with all the correct actions and views. It works currently perfectly with a new_html.erb view that uses a form_for
containing a structure like:
<% form_for @ecard do |f| %>
when watching some tutorials i saw that people also use the structure:
<% form_for :ecard do |f| %>
It sounds logical.. but when i try to use the <% form_for
:ecard do |f| %> the resulting post goes to a different action then using <% form_for
@ecard do |f| %>..
<% form_for @ecard do |f| %> -> html result is:
<form action="/ecards" class="new_ecard" id="new_ecard" method="post">
<% form_for :ecard do |f| %> -> html result is:
<form action="/ecards/new" method="post">
So i am wondering what i am missing, the difference in using :ecard and @ecard are obvious when i look at the generated html but i am still wondering what the reasoning behind this is!
So can anyone please explain what the difference is and what structure i am supposed to be using?? Is it <% form_for
@ecard do |f| %> or <% form_for
@ecard do |f| %>