lundi 24 août 2015

Accepts button in rails application

I have an users model ( cliens and perfomers) and also cliens has an order. Perfomers could accepts this orders and i need to put accept button in show template of order.

<% if current_user.user_type == "perfomer" %>
<% if !@order.order_perfomer_id.nil? %>
<h1><%=@order.order_perfomer_id %>
<% end %>
<%= form_for @order do |f| %>
<%= f.submit "Accept order!", :name =>"accept" %>
<% end %>
<% end %> 

And after this i check in controller

def show
if !params[:accept].nil?
@order.order_perfomer_id = current_user.id
end

Yes it doesnt work, because it is a wrong way. Can anyone help with my problem?

Aucun commentaire:

Enregistrer un commentaire