Hej mam taką tabelkę w widoku:
[code]
<%= sortable "cityFrom" %> | <%= sortable "cityTo" %> | <%= sortable "dateOfTrip" %> | <%= sortable "endOfTrip" %> | <%= sortable "bus_id" %> | Seat in the bus | |||||
---|---|---|---|---|---|---|---|---|---|---|
<%= ticket.cityFrom %> | <%= ticket.cityTo %> | <%= ticket.dateOfTrip.strftime("%A %d-%m-%Y %H:%M") %> | <%= ticket.endOfTrip.strftime("%A %d-%m-%Y %H:%M") %> | <% if ticket.bus_id != nil %><%= link_to Bus.find(ticket.bus_id).nameOfBus, bus_path(Bus.find(ticket.bus_id)) %> | <%= ticket.nameOfSeat %> | <% end %> <% if current_user.admin? %><%= link_to 'Show', ticket %> | <%= link_to 'Edit', edit_ticket_path(ticket) %> | <%= button_to 'Destroy', ticket, :confirm => 'Are you sure?', :method => :delete %> | <% else %> <% if ticket.user_reserved_id == 0 %><%= button_to 'Reserve', reserve_ticket_path(ticket), :confirm => "Are you sure, u want to reserve this ticket?", :method => :put%> | <% else %><%= button_to 'Unreserve', unreserve_ticket_path(ticket), :confirm => "Are you sure, u want to unreserve this ticket?", :method => :put%> | <% end %> <% end %>