Sha256: 75d66746d277929b726d0a63a9ab8629bb6a7ba70f0ee6fca2d45a1635181d10
Contents?: true
Size: 1.39 KB
Versions: 3
Compression:
Stored size: 1.39 KB
Contents
class RailsOps::Operation::Model::Update < RailsOps::Operation::Model::Load model_authorization_action :update lock_mode :exclusive # As this operation might extend the model class, we need to make sure that # the operation works using an extended 'copy' of the given model class. def self.always_extend_model_class? true end policy :before_perform do if model_authorization_action && self.class._model_authorization_lazy authorize_model! model_authorization_action, model end end def model_authorization return unless authorization_enabled? if self.class._model_authorization_lazy if load_model_authorization_action.nil? fail RailsOps::Exceptions::NoAuthorizationPerformed, "Operation #{self.class.name} must specify a "\ 'load_model_authorization_action because model '\ 'authorization is configured to be lazy.' else authorize_model! load_model_authorization_action, model end elsif !load_model_authorization_action.nil? authorize_model_with_authorize_only! load_model_authorization_action, model end unless model_authorization_action.nil? || self.class._model_authorization_lazy authorize_model! model_authorization_action, model end end def build_model super build_nested_model_ops :update assign_attributes end def perform save! end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rails_ops-1.4.1 | lib/rails_ops/operation/model/update.rb |
rails_ops-1.4.0 | lib/rails_ops/operation/model/update.rb |
rails_ops-1.3.0 | lib/rails_ops/operation/model/update.rb |