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

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -