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
14 15 16 |
# File 'lib/hideable/active_record.rb', line 14 def hidden where(self.arel_table[:hidden_at].not_eq(nil)) end |
#hideable(options = {}) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# 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? if [:updated] after_save [:updated] end end |
#not_hidden ⇒ Object
18 19 20 |
# File 'lib/hideable/active_record.rb', line 18 def not_hidden where(self.arel_table[:hidden_at].eq(nil)) end |