Ruby on Rails: Call controller method on specific model from view -


i new ruby , rails. have view displays list of course offerings.

<% if defined?@offerings %>    ..... <% @offerings.each |offering| %>     <tr>       <td><%=offering.semester %></td>       <td><%=offering.location %></td>     </tr>   <%end %> 

i need add enroll button associated each offering. enroll button should call offerings controller method decrements specific offerings capacity attribute.

how can bind each button respective offering? or alternatively how can pass correct offering parameter controller method?

add <td>, :

<td><%= link_to "enroll", your_method_path(offering) %></td> 

Comments

Popular posts from this blog

c# - Class in a list -

mysql - Django database model for my website -

ios - How to run a segue on itself OR another viewController -