Sha256: 20e67aec2783638c40e7d99f2fea550e85833648fa02bf5f807995fe72a21301

Contents?: true

Size: 504 Bytes

Versions: 4

Compression:

Stored size: 504 Bytes

Contents

module RailsMacros
  # NOTE: This method is not fun to maintain but we need it to make sure
  # Partisan methods return *real* not-loaded ActiveRecord relations
  def relation_class(klass)
    if ActiveRecord::VERSION::MAJOR == 3
      ActiveRecord::Relation
    elsif [ActiveRecord::VERSION::MAJOR, ActiveRecord::VERSION::MINOR] == [4, 0]
      "ActiveRecord::Relation::ActiveRecord_Relation_#{klass.name}".constantize
    else
      "#{klass.name}::ActiveRecord_Relation".constantize
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
partisan-0.5.1 spec/support/macros/rails_macros.rb
partisan-0.5 spec/support/macros/rails_macros.rb
partisan-0.4.2 spec/support/macros/rails_macros.rb
partisan-0.4.1 spec/support/macros/rails_macros.rb