Method: Mongoid::Relations::Accessors::ClassMethods#ids_getter
- Defined in:
- lib/mongoid/relations/accessors.rb
#ids_getter(name, metadata) ⇒ Class
Defines the getter for the ids of documents in the relation. Should be specify only for referenced many relations.
238 239 240 241 242 243 244 |
# File 'lib/mongoid/relations/accessors.rb', line 238 def ids_getter(name, ) ids_method = "#{name.to_s.singularize}_ids" re_define_method(ids_method) do send(name).only(:id).map(&:id) end self end |