Module: ParanoidFu::ReflectionConditions
- Defined in:
- lib/paranoid_fu/reflection_conditions.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#sanitized_conditions_with_paranoid_fu ⇒ Object
Returns the SQL string that corresponds to the
:conditionsoption of the macro, if given, ornilotherwise.
Class Method Details
.included(base) ⇒ Object
3 4 5 6 7 |
# File 'lib/paranoid_fu/reflection_conditions.rb', line 3 def self.included(base) base.class_eval do alias_method_chain :sanitized_conditions, :paranoid_fu end end |
Instance Method Details
#sanitized_conditions_with_paranoid_fu ⇒ Object
Returns the SQL string that corresponds to the :conditions option of the macro, if given, or nil otherwise.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/paranoid_fu/reflection_conditions.rb', line 11 def sanitized_conditions_with_paranoid_fu sanitized_conditions_without_paranoid_fu if !self.[:polymorphic] && self.[:without_deleted] klass = if self.through_reflection self.through_reflection.klass else self.klass end klass.merge_conditions(@sanitized_conditions, klass.without_deleted_conditions(klass.table_name)) if klass else @sanitized_conditions end end |