Class: ActiveRecord::Collection
- Inherits:
-
Object
- Object
- ActiveRecord::Collection
- Includes:
- ActiveRecord::Collections::Batching, ActiveRecord::Collections::Delegation, ActiveRecord::Collections::QueryChain, ActiveRecord::Collections::Records, ActiveRecord::Collections::Serialization
- Defined in:
- lib/active_record/collection.rb
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#relation ⇒ Object
readonly
Returns the value of attribute relation.
Instance Method Summary collapse
-
#inspect ⇒ Object
dup relation and call none so that we don’t end up inspecting it and loading it before we want it.
Methods included from ActiveRecord::Collections::Serialization
included, #to_hash, #to_json, #to_param, #to_sql
Methods included from ActiveRecord::Collections::Delegation
included, #method_missing, #on_records, #on_relation, #respond_to_missing?
Methods included from ActiveRecord::Collections::Batching
#as_batch, #as_batches, #as_next_batch, #batch_by_default?, #batching_threshold, #current_page, #default_batch_size, #each_page, #first_page, #first_page!, #flat_page_map, included, #is_batch!, #is_batch?, #last_page, #last_page!, #next_page, #next_page!, #next_page?, #page, #page!, #page_map, #paginated?, #per, #per!, #per_page, #prev_page, #prev_page!, #prev_page?, #should_batch?, #to_batches, #total_pages
Methods included from ActiveRecord::Collections::Records
#each, #flat_map, #length, #map, #pluck, #record_ids, #records, #size, #to_ary, #total_count, #total_records
Methods included from ActiveRecord::Collections::QueryChain
#all, #distinct, #distinct!, included, #includes, #includes!, #joins, #joins!, #limit, #limit!, #load, #not, #not!, #or, #or!, #order, #order!, #references, #references!, #reset, #reset!, #select, #select!, #where, #where!
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ActiveRecord::Collections::Delegation
Instance Attribute Details
#model ⇒ Object (readonly)
Returns the value of attribute model.
8 9 10 |
# File 'lib/active_record/collection.rb', line 8 def model @model end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/active_record/collection.rb', line 8 def @options end |
#relation ⇒ Object (readonly)
Returns the value of attribute relation.
8 9 10 |
# File 'lib/active_record/collection.rb', line 8 def relation @relation end |
Instance Method Details
#inspect ⇒ Object
dup relation and call none so that we don’t end up inspecting it and loading it before we want it
12 13 14 15 16 17 18 |
# File 'lib/active_record/collection.rb', line 12 def inspect relation_backup = relation.dup @records = @relation = relation.none inspected = super @records = @relation = relation_backup inspected end |