Module: Trailblazer::Operation::CRUD

Defined in:
lib/trailblazer/operation/crud.rb

Overview

The CRUD module will automatically create/find models for the configured action. It adds a public Operation#model reader to access the model (after performing).

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#modelObject (readonly)

Returns the value of attribute model.



6
7
8
# File 'lib/trailblazer/operation/crud.rb', line 6

def model
  @model
end

Class Method Details

.included(base) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/trailblazer/operation/crud.rb', line 8

def self.included(base)
  base.extend Uber::InheritableAttr
  base.inheritable_attr :config
  base.config = {}

  base.extend ClassMethods
end

Instance Method Details

#validate(params, *args) ⇒ Object

#validate no longer accepts a model since this module instantiates it for you.



37
38
39
# File 'lib/trailblazer/operation/crud.rb', line 37

def validate(params, *args)
  super(params, @model, *args)
end