提交 d168c1f7 编写于 作者: R Rafael Mendonça França

Merge pull request #6606 from amatsuda/ar_relation_model_method

AR::Relation#model would be a better API than AR::Relation#klass
......@@ -18,6 +18,7 @@ class Relation
attr_reader :table, :klass, :loaded
attr_accessor :default_scoped
alias :model :klass
alias :loaded? :loaded
alias :default_scoped? :default_scoped
......
......@@ -19,6 +19,11 @@ def test_construction
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|
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册