Module: ActiveModel::Serializer::Associations::ClassMethods
- Defined in:
- lib/active_model/serializer/concerns/associations.rb
Instance Method Summary collapse
- #belongs_to(name, options = {}, &block) ⇒ void
- #has_many(name, options = {}, &block) ⇒ void
- #has_one(name, options = {}, &block) ⇒ void
- #inherited(base) ⇒ Object
Instance Method Details
#belongs_to(name, options = {}, &block) ⇒ void
This method returns an undefined value.
53 54 55 |
# File 'lib/active_model/serializer/concerns/associations.rb', line 53 def belongs_to(name, = {}, &block) associate(BelongsToReflection.new(name, , block)) end |
#has_many(name, options = {}, &block) ⇒ void
This method returns an undefined value.
42 43 44 |
# File 'lib/active_model/serializer/concerns/associations.rb', line 42 def has_many(name, = {}, &block) # rubocop:disable Style/PredicateName associate(HasManyReflection.new(name, , block)) end |
#has_one(name, options = {}, &block) ⇒ void
This method returns an undefined value.
64 65 66 |
# File 'lib/active_model/serializer/concerns/associations.rb', line 64 def has_one(name, = {}, &block) # rubocop:disable Style/PredicateName associate(HasOneReflection.new(name, , block)) end |
#inherited(base) ⇒ Object
30 31 32 33 |
# File 'lib/active_model/serializer/concerns/associations.rb', line 30 def inherited(base) super base._reflections = _reflections.dup end |