Skip to content

Commit

Permalink
use AR.sequence_name instead of sql
Browse files Browse the repository at this point in the history
  • Loading branch information
razum2um committed May 28, 2014
1 parent 2bf53e4 commit a00a8d4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions templates/generate_stuff.rb
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,8 @@ class Api::V2::ReposController < Api::V1::ReposController; end
class ActionDispatch::IntegrationTest
def setup
super if defined? super
%w[repos_id_seq users_id_seq].each do |id|
ActiveRecord::Base.connection.execute "ALTER SEQUENCE \#{id} RESTART WITH 1"
[User, Repo].each do |klass|
ActiveRecord::Base.connection.execute "ALTER SEQUENCE \#{klass.sequence_name} RESTART WITH 1"
end
DatabaseCleaner.start
end
Expand Down Expand Up @@ -354,8 +354,8 @@ def teardown
]
c.before do
%w[repos_id_seq users_id_seq].each do |id|
ActiveRecord::Base.connection.execute "ALTER SEQUENCE \#{id} RESTART WITH 1"
[User, Repo].each do |klass|
ActiveRecord::Base.connection.execute "ALTER SEQUENCE \#{klass.sequence_name} RESTART WITH 1"
end
DatabaseCleaner.start
end
Expand Down

0 comments on commit a00a8d4

Please sign in to comment.