Module: Granite::Action::Subject

Extended by:
ActiveSupport::Concern
Included in:
Granite::Action
Defined in:
lib/granite/action/subject.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#initialize(*args) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/granite/action/subject.rb', line 34

def initialize(*args)
  if self.class._subject.blank?
    super
    return
  end

  reflection = self.class.reflect_on_association(self.class._subject)
  attributes = extract_initialize_attributes(args)

  subject_attributes = extract_subject_attributes!(attributes, reflection)
  assign_subject(args, subject_attributes, reflection)

  super attributes
end