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



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/granite/action/subject.rb', line 42

def initialize(*args)
  return super unless self.class.subject? # rubocop:disable Lint/ReturnInVoidContext

  reflection = self.class.subject_reflection
  attributes = extract_initialize_attributes(args)

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

  super attributes
end