Module: Granite::Action::Subject::ClassMethods
- Defined in:
- lib/granite/action/subject.rb
Instance Method Summary collapse
Instance Method Details
#subject(name, *args, &block) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/granite/action/subject.rb', line 23 def subject(name, *args, &block) reflection = reflect_on_association(name) reflection ||= references_one name, *args, &block alias_association :subject, reflection.name alias_attribute :id, reflection.reference_key self._subject = name end |
#subject? ⇒ Boolean
33 34 35 |
# File 'lib/granite/action/subject.rb', line 33 def subject? _subject.present? end |
#subject_reflection ⇒ Object
37 38 39 |
# File 'lib/granite/action/subject.rb', line 37 def subject_reflection reflect_on_association(_subject) end |