1
0
Fork 0
mirror of https://github.com/paper-trail-gem/paper_trail.git synced 2022-11-09 11:33:19 -05:00

remove code that are not necessary

This commit is contained in:
Ben Li 2014-12-04 23:04:37 +11:00
parent a2b96afa8e
commit 5903354fbe
2 changed files with 1 additions and 24 deletions

View file

@ -95,17 +95,7 @@ module PaperTrail
end
def self.transaction?
ActiveRecord::Base.connection.open_transactions > 0 || paper_trail_store[:transaction_open]
end
def self.start_transaction
paper_trail_store[:transaction_open] = true
self.transaction_id = nil
end
def self.end_transaction
paper_trail_store[:transaction_open] = false
self.transaction_id = nil
ActiveRecord::Base.connection.open_transactions > 0
end
def self.transaction_id

View file

@ -171,10 +171,6 @@ module PaperTrail
model.send "#{model.class.version_association_name}=", self
# unless options[:has_one] == false
# reify_has_ones model, options[:has_one]
# end
unless options[:has_one] == false
reify_has_ones model, options
end
@ -200,15 +196,6 @@ module PaperTrail
{}
end
# Rollback all changes within a transaction
def rollback
transaction do
self.class.within_transaction(transaction_id).reverse_each do |version|
version.reify.save!
end
end
end
# Returns who put the item into the state stored in this version.
def originator
@originator ||= previous.whodunnit rescue nil