1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

AR::Integration must be included after AM::Conversion

Integration's definition of #to_param must override
Conversion's. Otherwise, there is a regression from
3.1 in the behavior of a non-persisted AR::Base instance
which nevertheless has an id.
This commit is contained in:
John Firebaugh 2012-07-17 15:16:43 -07:00
parent d8745decaf
commit 80f61259f9
2 changed files with 7 additions and 1 deletions

View file

@ -74,9 +74,9 @@ module ActiveRecord
include Inheritance
include Scoping
include Sanitization
include Integration
include AttributeAssignment
include ActiveModel::Conversion
include Integration
include Validations
include CounterCache
include Locking::Optimistic

View file

@ -1684,6 +1684,12 @@ class BasicsTest < ActiveRecord::TestCase
assert_kind_of String, Client.first.to_param
end
def test_to_param_returns_id_even_if_not_persisted
client = Client.new
client.id = 1
assert_equal "1", client.to_param
end
def test_inspect_class
assert_equal 'ActiveRecord::Base', ActiveRecord::Base.inspect
assert_equal 'LoosePerson(abstract)', LoosePerson.inspect