diff options
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/CHANGELOG | 2 | ||||
-rwxr-xr-x | activerecord/lib/active_record/associations.rb | 2 | ||||
-rw-r--r-- | activerecord/test/modules_test.rb | 7 |
3 files changed, 10 insertions, 1 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index d4e2e05dbc..c012f0d131 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Call Inflector#demodulize on the class name when eagerly including an STI model. Closes #5077 [info@loobmedia.com] + * Preserve MySQL boolean column defaults when changing a column in a migration. Closes #5015. [pdcawley@bofh.org.uk] * PostgreSQL: migrations support :limit with :integer columns by mapping limit < 4 to smallint, > 4 to bigint, and anything else to integer. #2900 [keegan@thebasement.org] diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 31546e9c29..717483cf3e 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1515,7 +1515,7 @@ module ActiveRecord join << %(AND %s.%s = %s ) % [ aliased_table_name, reflection.active_record.connection.quote_column_name(reflection.active_record.inheritance_column), - klass.quote(klass.name)] unless klass.descends_from_active_record? + klass.quote(klass.name.demodulize)] unless klass.descends_from_active_record? join << "AND #{interpolate_sql(sanitize_sql(reflection.options[:conditions]))} " if reflection.options[:conditions] join end diff --git a/activerecord/test/modules_test.rb b/activerecord/test/modules_test.rb index 6f919bbd78..b2ef8730ea 100644 --- a/activerecord/test/modules_test.rb +++ b/activerecord/test/modules_test.rb @@ -25,4 +25,11 @@ class ModulesTest < Test::Unit::TestCase assert_kind_of MyApplication::Billing::Nested::Firm, account.nested_qualified_billing_firm assert_kind_of MyApplication::Billing::Nested::Firm, account.nested_unqualified_billing_firm end + + def test_find_account_and_include_company + account = MyApplication::Billing::Account.find(1, :include => :firm) + assert_kind_of MyApplication::Business::Firm, account.instance_variable_get('@firm') + assert_kind_of MyApplication::Business::Firm, account.firm + end + end |