mirror of https://github.com/rails/rails
Merge pull request #6606 from amatsuda/ar_relation_model_method
AR::Relation#model would be a better API than AR::Relation#klass
This commit is contained in:
commit
d168c1f7a7
|
@ -18,6 +18,7 @@ module ActiveRecord
|
|||
|
||||
attr_reader :table, :klass, :loaded
|
||||
attr_accessor :default_scoped
|
||||
alias :model :klass
|
||||
alias :loaded? :loaded
|
||||
alias :default_scoped? :default_scoped
|
||||
|
||||
|
|
|
@ -19,6 +19,11 @@ module ActiveRecord
|
|||
assert !relation.loaded, 'relation is not loaded'
|
||||
end
|
||||
|
||||
def test_responds_to_model_and_returns_klass
|
||||
relation = Relation.new :a, :b
|
||||
assert_equal :a, relation.model
|
||||
end
|
||||
|
||||
def test_initialize_single_values
|
||||
relation = Relation.new :a, :b
|
||||
(Relation::SINGLE_VALUE_METHODS - [:create_with]).each do |method|
|
||||
|
|
Loading…
Reference in New Issue