You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, if a user cannot edit it, clicking the order redirects them back to the orders page. Perhaps the controller should look something like this:
def edit
@order = Order.includes(order_details: :item).find(params[:id])
if current_user.can_edit_order?(@order)
if Rails.root.join("app/views/orders/status/#{@order.status}.html.erb").exist?
render "orders/status/#{@order.status}"
end
elsif current_user.can_view_order?(@order)
render "orders/show"
else
redirect_to orders_path
end
end
The text was updated successfully, but these errors were encountered:
Currently, if a user cannot edit it, clicking the order redirects them back to the orders page. Perhaps the controller should look something like this:
The text was updated successfully, but these errors were encountered: