Method: Strongbolt::BoltedController::ClassMethods#model_for_authorization=

Defined in:
lib/strongbolt/bolted_controller.rb

#model_for_authorization=(model) ⇒ Object

Allows defining a specific model for this controller, if it cannot be infer from the controller name



21
22
23
24
25
26
27
28
29
# File 'lib/strongbolt/bolted_controller.rb', line 21

def model_for_authorization=(model)
  @model_for_authorization = case model
                             when Class then model
                             when String then constantize_model(model)
                             when nil then nil
                             else
                               raise ArgumentError, 'Model for authorization must be a Class or the name of the Class'
                             end
end