Module: InPlaceRelation::Methods

Defined in:
lib/in_place_relation.rb

Instance Method Summary collapse

Instance Method Details

#in_placeObject



9
10
11
12
13
14
15
16
17
18
# File 'lib/in_place_relation.rb', line 9

def in_place
  # Previously, to keep things unified we always want a Relation here even
  # if initial object was a model class or an association.
  # But the problem is that now rel.is_a? triggers fetch on an association
  # (really, how stupid you have to be to create a monster like
  # ActiveRecord::Associations::CollectionAssociation that even returns
  # Array as it's class?
  #rel = self.is_a?( ActiveRecord::Relation ) ? self : self.scoped
  return Wrapper.new( respond_to?( :scoped) ? scoped : all )
end