Module: Hideable::ActiveRecord
- Defined in:
- lib/hideable/active_record.rb,
lib/hideable/active_record/instance_methods.rb
Defined Under Namespace
Modules: InstanceMethods
Instance Method Summary collapse
Instance Method Details
#hidden ⇒ Object
11 12 13 |
# File 'lib/hideable/active_record.rb', line 11 def hidden where(self.arel_table[:hidden_at].not_eq(nil)) end |
#hideable(options = {}) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/hideable/active_record.rb', line 4 def hideable( = {}) send :include, InstanceMethods class_attribute :hide_dependents self.hide_dependents = [:dependent] == :hide ? true : false after_save :update_hideable_dependents!, :if => :update_hideable_dependents? end |
#not_hidden ⇒ Object
15 16 17 |
# File 'lib/hideable/active_record.rb', line 15 def not_hidden where(self.arel_table[:hidden_at].eq(nil)) end |