Fixed PostgreSQL usage of fixtures with regards to public schemas and table...

Fixed PostgreSQL usage of fixtures with regards to public schemas and table names with dots #962 [gnuman1@gmail.com]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1206 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 03097d3a
*SVN* *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 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] * Fixed loading of fixtures in to be in the right order (or PostgreSQL would bark) #1047 [stephenh@chase3000.com]
......
...@@ -188,7 +188,7 @@ def self.instantiate_fixtures(object, table_name, fixtures, load_instances=true) ...@@ -188,7 +188,7 @@ def self.instantiate_fixtures(object, table_name, fixtures, load_instances=true)
old_logger_level = ActiveRecord::Base.logger.level old_logger_level = ActiveRecord::Base.logger.level
ActiveRecord::Base.logger.level = Logger::ERROR 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 if load_instances
fixtures.each do |name, fixture| fixtures.each do |name, fixture|
if model = fixture.find if model = fixture.find
...@@ -243,7 +243,7 @@ def self.reset_sequences(connection, table_names) ...@@ -243,7 +243,7 @@ def self.reset_sequences(connection, table_names)
pk = eval("#{table_class}::primary_key") pk = eval("#{table_class}::primary_key")
if pk == 'id' if pk == 'id'
connection.execute( 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' 'Setting Sequence'
) )
end end
......
...@@ -35,7 +35,7 @@ def test_symbol_scope ...@@ -35,7 +35,7 @@ def test_symbol_scope
def check_method_mixins( obj ) def check_method_mixins( obj )
[:scope_condition, :left_col_name, :right_col_name, :parent_column, :root?, :add_child, [: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 end
def set( id ) def set( id )
...@@ -181,4 +181,4 @@ def test_common_usage ...@@ -181,4 +181,4 @@ def test_common_usage
end end
end end
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册