diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index e9a23dc20a..bb183945a6 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Fixed PostgreSQL usage of fixtures with regards to public schemas and table names with dots #962 [gnuman1@gmail.com] + * Fixed that fixtures were being deleted in the same order as inserts causing FK errors #890 [andrew.john.peters@gmail.com] * Fixed loading of fixtures in to be in the right order (or PostgreSQL would bark) #1047 [stephenh@chase3000.com] diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb index 50a824987d..ce79efc648 100755 --- a/activerecord/lib/active_record/fixtures.rb +++ b/activerecord/lib/active_record/fixtures.rb @@ -188,7 +188,7 @@ class Fixtures < Hash old_logger_level = ActiveRecord::Base.logger.level ActiveRecord::Base.logger.level = Logger::ERROR - object.instance_variable_set "@#{table_name}", fixtures + object.instance_variable_set "@#{table_name.to_s.gsub('.','_')}", fixtures if load_instances fixtures.each do |name, fixture| if model = fixture.find @@ -243,7 +243,7 @@ class Fixtures < Hash pk = eval("#{table_class}::primary_key") if pk == 'id' connection.execute( - "SELECT setval('public.#{table.to_s}_id_seq', (SELECT MAX(id) FROM #{table.to_s}), true)", + "SELECT setval('#{table.to_s}_id_seq', (SELECT MAX(id) FROM #{table.to_s}), true)", 'Setting Sequence' ) end diff --git a/activerecord/test/mixin_nested_set_test.rb b/activerecord/test/mixin_nested_set_test.rb index 90eb0fbcd2..746c8aaf08 100644 --- a/activerecord/test/mixin_nested_set_test.rb +++ b/activerecord/test/mixin_nested_set_test.rb @@ -35,7 +35,7 @@ class MixinNestedSetTest < Test::Unit::TestCase def check_method_mixins( obj ) [:scope_condition, :left_col_name, :right_col_name, :parent_column, :root?, :add_child, - :children_count, :full_set, :all_children, :direct_children].each { |symbol| assert( obj.respond_to? symbol ) } + :children_count, :full_set, :all_children, :direct_children].each { |symbol| assert( obj.respond_to?(symbol)) } end def set( id ) @@ -181,4 +181,4 @@ class MixinNestedSetTest < Test::Unit::TestCase end -end \ No newline at end of file +end