Class: Grape::Roar::Extensions::Relations::Adapters::Mongoid
- Includes:
- Validations::Mongoid
- Defined in:
- lib/grape/roar/extensions/relations/adapters/mongoid.rb
Instance Method Summary collapse
- #collection_methods ⇒ Object
- #name_for_represented(represented) ⇒ Object
- #single_entity_methods ⇒ Object
Methods included from Validations::Mongoid
#belongs_to_valid?, #embeds_many_valid?, #embeds_one_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 16 17 |
# File 'lib/grape/roar/extensions/relations/adapters/mongoid.rb', line 13 def collection_methods @collection_methods ||= %i[ embeds_many has_many has_and_belongs_to_many ] end |
#name_for_represented(represented) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/grape/roar/extensions/relations/adapters/mongoid.rb', line 19 def name_for_represented(represented) klass_name = if represented.instance_of?( ::Mongoid::Relations::Targets::Enumerable ) represented.klass.name else represented.class.name end klass_name.demodulize.pluralize.downcase end |
#single_entity_methods ⇒ Object
30 31 32 |
# File 'lib/grape/roar/extensions/relations/adapters/mongoid.rb', line 30 def single_entity_methods @single_entity_methods ||= %i[has_one belongs_to embeds_one] end |