Skip to content

Commit

Permalink
use class_attribute instead of the deprecated class_inheritable_acces…
Browse files Browse the repository at this point in the history
…sor.
  • Loading branch information
botandrose-machine committed Sep 14, 2011
1 parent 13a1dcc commit aa7cbe2
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions lib/cucumber/rails/hooks/active_record.rb
@@ -1,6 +1,6 @@
if defined?(ActiveRecord::Base)
class ActiveRecord::Base
class_inheritable_accessor :shared_connection
class_attribute :shared_connection

def self.connection
self.shared_connection || retrieve_connection
Expand All @@ -12,16 +12,10 @@ def self.connection
# as connections may vary per model as per establish_connection. This works
# on Capybara because it starts the web server in a thread.
ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection
ActiveRecord::Base.descendants.each do |model|
model.shared_connection = model.connection
end
end

Before('~@javascript') do
# Do not use a shared connection unless we're in a @javascript scenario
ActiveRecord::Base.shared_connection = nil
ActiveRecord::Base.descendants.each do |model|
model.shared_connection = nil
end
end
end

0 comments on commit aa7cbe2

Please sign in to comment.