The following code works fine:
<table border="1">
<% @allevents.each do |allevent| %>
<tr>
<td><%= allevent.name %></td>
<td><%= button_to "View", :action => "view", :allevent_id => "0000000000000131"%>
</tr>
<% end %>
</table>
However when I swap out the ID I’m passing to :
<%= button_to "View", :action => "view", allevent_id %>
Its passing a nil value. Any idea how I can reference this correctly? It doesn’t seem to like allevent.id but the allevent_id is nil? I tested displaying allevent.id in output text and it looked correct.
Controller code for reference:
def index
@allevents = Event.all
end
Also wanted to add my routes.rb code which seems to vague:
match 'event/:action' => 'events#view'
Thanks in advance!
try: