hyperlink - Ruby on Rails: Create record from link -


How do I issue a create order from a link? I have an if / else statement that displays editing or making, but I have not found the correct method of recording.

I had this, but then I have to refresh the page to get this function, which I can not have:

  & amp; Lt;% If FollowUwyk Where (subject_id: sub. Point_id). First! = ZERO% & gt; & Lt;% = link_to "edit", follow_up3_week_path ([FollowUp3Week.where (subject_id: sub.subject_id). First])% & gt; & lt;% else% & gt; & Lt;% = FollowUp3Week.create (subject_id: sub.subject_id)%> & Lt;% end% & gt;   

And I'm trying this, but there is no luck yet (where topics are the link to the current page):

   <% else%>  <% code%   

Whatever suggestions, or references I should read, be greatly appreciated

I really want to 'create' the link to generate a 'edit' link.

Thank you for your time.

You call a controller You will only be able to create a record, so what you want to do in your case, to create the link is to present only the url. The controller who has done the construction, once the user clicks the link that your administrator Triggers a request that will create a record.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -