Class: Grape::Roar::Extensions::Relations::Adapters::ActiveRecord
- Includes:
- Validations::ActiveRecord
- Defined in:
- lib/grape/roar/extensions/relations/adapters/active_record.rb
Instance Method Summary collapse
- #collection_methods ⇒ Object
- #name_for_represented(represented) ⇒ Object
- #single_entity_methods ⇒ Object
Methods included from Validations::ActiveRecord
#belongs_to_valid?, #has_and_belongs_to_many_valid?, #has_many_valid?, #has_one_valid?
Methods included from Validations::Misc
Methods inherited from Base
#initialize, valid_for, valid_for?
Constructor Details
This class inherits a constructor from Grape::Roar::Extensions::Relations::Adapters::Base
Instance Method Details
#collection_methods ⇒ Object
13 14 15 |
# File 'lib/grape/roar/extensions/relations/adapters/active_record.rb', line 13 def collection_methods @collection_methods ||= %i[has_many has_and_belongs_to_many] end |
#name_for_represented(represented) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/grape/roar/extensions/relations/adapters/active_record.rb', line 17 def name_for_represented(represented) klass_name = case represented when ::ActiveRecord::Relation represented.klass.name else represented.class.name end klass_name.demodulize.pluralize.downcase end |
#single_entity_methods ⇒ Object
27 28 29 |
# File 'lib/grape/roar/extensions/relations/adapters/active_record.rb', line 27 def single_entity_methods @single_entity_methods ||= %i[has_one belongs_to] end |