Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Define default scope if table exists #6

Merged
merged 1 commit into from

2 participants

@steved

No description provided.

@grosser grosser merged commit dcb6aee into grosser:master
@grosser
Owner

0.1.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 29, 2012
  1. @steved
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 4 deletions.
  1. +2 −4 lib/soft_deletion.rb
View
6 lib/soft_deletion.rb
@@ -11,12 +11,10 @@ def self.included(base)
if base.respond_to?(:define_default_soft_delete_scope)
base.define_default_soft_delete_scope
- else
+ elsif base.table_exists? && base.column_names.include?('deleted_at')
# Avoids a bad SQL request with versions of code without the column deleted_at (for example a migration prior to the migration
# that adds deleted_at)
- if base.column_names.include?('deleted_at')
- base.send(:default_scope, :conditions => { :deleted_at => nil })
- end
+ base.send(:default_scope, :conditions => { :deleted_at => nil })
end
# backport after_soft_delete so we can safely upgrade to rails 3
Something went wrong with that request. Please try again.