Sha256: bda6dc3c78aa44fe42b704e4a03e7a4e9b04bb68fe8056440c5dd4596c7a7069
Contents?: true
Size: 848 Bytes
Versions: 38
Compression:
Stored size: 848 Bytes
Contents
class RailsOps::Operation::Model::Create < RailsOps::Operation::Model model_authorization_action :create policy :on_init do model_authorization end # 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 def model_authorization return unless authorization_enabled? unless model_authorization_action.nil? authorize_model! model_authorization_action, model end end def build_model fail 'Model can only be built once.' if defined?(@model) && @model @model = self.class.model.new if @model.respond_to?(:parent_op=) @model.parent_op = self end build_nested_model_ops :create assign_attributes end def perform save! end end
Version data entries
38 entries across 38 versions & 1 rubygems