Skip to content

Commit

Permalink
Merge branch 'core' into paranoia_aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
jhawthorn authored Nov 2, 2017
2 parents 0f25822 + acd43c1 commit c63e0ab
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source 'https://rubygems.org'
gem 'sqlite3', platforms: [:ruby]

platforms :jruby do
gem 'activerecord-jdbcsqlite3-adapter', github: 'jruby/activerecord-jdbc-adapter', branch: 'rails-5'
gem 'activerecord-jdbcsqlite3-adapter'
end

platforms :rbx do
Expand All @@ -12,7 +12,7 @@ platforms :rbx do
gem 'rubinius-developer_tools'
end

rails = ENV['RAILS'] || '~> 4.2.0'
rails = ENV['RAILS'] || '~> 5.1.0'

gem 'rails', rails

Expand Down
2 changes: 1 addition & 1 deletion lib/paranoia.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def really_destroy!
association_data.really_destroy!
end
end
write_attribute(paranoia_column, current_time_from_proper_timezone)
update_columns(paranoia_destroy_attributes)
destroy_without_paranoia
end
end
Expand Down
12 changes: 12 additions & 0 deletions test/paranoia_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

test_framework = defined?(MiniTest::Test) ? MiniTest::Test : MiniTest::Unit::TestCase

if ActiveRecord::Base.respond_to?(:raise_in_transactional_callbacks=)
ActiveRecord::Base.raise_in_transactional_callbacks = true
end

def connect!
ActiveRecord::Base.establish_connection :adapter => 'sqlite3', database: ':memory:'
end
Expand Down Expand Up @@ -546,6 +550,14 @@ def test_really_destroy_behavior_for_callbacks
assert model.instance_variable_get(:@real_destroy_callback_called)
end

def test_really_destroy_behavior_for_active_column_model
model = ActiveColumnModel.new
model.save
model.really_destroy!

refute ParanoidModel.unscoped.exists?(model.id)
end

def test_really_delete
model = ParanoidModel.new
model.save
Expand Down

0 comments on commit c63e0ab

Please sign in to comment.