| Class | OrdersController |
| In: |
app/controllers/orders_controller.rb
|
| Parent: | GenericRestController |
# File app/controllers/orders_controller.rb, line 27
27: def show
28: super
29: set_current_order( resource )
30: end
Fake out the generic UI — even when users can create an order, we don‘t want them doing it here…
# File app/controllers/orders_controller.rb, line 56
56: def can_create?; false; end
Here‘s a messy corner case:
Users have permission to edit only their unpaid orders. When they pay, they lose that permission. But, if they thereby lose :update permission, then they can‘t save the paid version of the order. So, for orders, update and edit permissions are different, and we can‘t automatically infer one from the other in the "generic" way. Thus…
# File app/controllers/orders_controller.rb, line 49
49: def can_edit?( order )
50: order.permits?( :update )
51: end