Skip to content
This repository has been archived by the owner on Jun 30, 2021. It is now read-only.

Changes to rails3_acts_as_paranoid for Rails 3.1 #46

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -4,5 +4,5 @@ gem "rails3_acts_as_paranoid", :path => File.expand_path("..", __FILE__)

# Development dependencies
gem "rake"
gem "activesupport", "~>3.0"
gem "activesupport", "~>3.1"
gem "sqlite3-ruby"
40 changes: 21 additions & 19 deletions Gemfile.lock
@@ -1,36 +1,38 @@
PATH
remote: .
specs:
rails3_acts_as_paranoid (0.1.1)
activerecord (~> 3.0)
rails3_acts_as_paranoid (0.1.1.2)
activerecord (~> 3.1)

GEM
remote: http://rubygems.org/
specs:
activemodel (3.0.9)
activesupport (= 3.0.9)
builder (~> 2.1.2)
i18n (~> 0.5.0)
activerecord (3.0.9)
activemodel (= 3.0.9)
activesupport (= 3.0.9)
arel (~> 2.0.10)
tzinfo (~> 0.3.23)
activesupport (3.0.9)
arel (2.0.10)
builder (2.1.2)
i18n (0.5.0)
rake (0.8.7)
sqlite3 (1.3.3)
activemodel (3.1.3)
activesupport (= 3.1.3)
builder (~> 3.0.0)
i18n (~> 0.6)
activerecord (3.1.3)
activemodel (= 3.1.3)
activesupport (= 3.1.3)
arel (~> 2.2.1)
tzinfo (~> 0.3.29)
activesupport (3.1.3)
multi_json (~> 1.0)
arel (2.2.1)
builder (3.0.0)
i18n (0.6.0)
multi_json (1.0.4)
rake (0.9.2.2)
sqlite3 (1.3.5)
sqlite3-ruby (1.3.3)
sqlite3 (>= 1.3.3)
tzinfo (0.3.29)
tzinfo (0.3.31)

PLATFORMS
ruby

DEPENDENCIES
activesupport (~> 3.0)
activesupport (~> 3.1)
rails3_acts_as_paranoid!
rake
sqlite3-ruby
4 changes: 0 additions & 4 deletions lib/rails3_acts_as_paranoid.rb
Expand Up @@ -31,10 +31,6 @@ def acts_as_paranoid(options = {})
alias_method :destroy!, :destroy
end

ActiveRecord::Reflection::AssociationReflection.class_eval do
alias_method :foreign_key, :primary_key_name unless respond_to?(:foreign_key)
end

# Magic!
default_scope where("#{paranoid_column_reference} IS ?", nil)

Expand Down
3 changes: 2 additions & 1 deletion lib/validations/uniqueness_without_deleted.rb
Expand Up @@ -9,7 +9,8 @@ def validate_each(record, attribute, value)
value = YAML.dump value
end

sql, params = mount_sql_and_params(finder_class, record.class.quoted_table_name, attribute, value)
table = Arel::Table.new(record.class.table_name)
sql, params = build_relation(finder_class, table, attribute, value)

# This is the only changed line from the base class version - it does finder_class.unscoped
relation = finder_class.where(sql, *params)
Expand Down
14 changes: 7 additions & 7 deletions rails3_acts_as_paranoid.gemspec
@@ -1,17 +1,17 @@
Gem::Specification.new do |s|
s.name = "rails3_acts_as_paranoid"
s.version = "0.1.1"
s.version = "0.1.1.2"
s.platform = Gem::Platform::RUBY
s.authors = ["Goncalo Silva"]
s.email = ["goncalossilva@gmail.com"]
s.homepage = "http://github.com/goncalossilva/rails3_acts_as_paranoid"
s.summary = "Active Record (>=3.0) plugin which allows you to hide and restore records without actually deleting them."
s.description = "Active Record (>=3.0) plugin which allows you to hide and restore records without actually deleting them. Check its GitHub page for more in-depth information."
s.authors = ["Goncalo Silva", "Craig Walker"]
s.email = ["goncalossilva@gmail.com", "craig@softcraft.ca"]
s.homepage = "https://github.com/softcraft-development/rails3_acts_as_paranoid"
s.summary = "Active Record (>=3.1) plugin which allows you to hide and restore records without actually deleting them."
s.description = "Active Record (>=3.1) plugin which allows you to hide and restore records without actually deleting them. Check its GitHub page for more in-depth information."
s.rubyforge_project = s.name

s.required_rubygems_version = ">= 1.3.6"

s.add_dependency "activerecord", "~> 3.0"
s.add_dependency "activerecord", "~> 3.1"

s.files = Dir["{lib}/**/*.rb", "LICENSE", "*.markdown"]
end