Module: PrintingPress::Model::ClassMethods
- Defined in:
- lib/printing_press/publishable.rb
Instance Method Summary collapse
- #drafts ⇒ Object
- #printing_press_off ⇒ Object
- #printing_press_on ⇒ Object
- #publishable(options = {}) ⇒ Object
Instance Method Details
#drafts ⇒ Object
33 34 35 36 |
# File 'lib/printing_press/publishable.rb', line 33 def drafts self.find_by_sql("SELECT o.* FROM #{self.reset_table_name} o, #{self.published_table_name} p WHERE (o.id = p.id AND o.updated_at != p.updated_at)") + self.find_by_sql("SELECT * FROM #{self.reset_table_name} WHERE id NOT IN (SELECT id FROM #{self.published_table_name}) GROUP BY id") end |
#printing_press_off ⇒ Object
21 22 23 24 25 |
# File 'lib/printing_press/publishable.rb', line 21 def printing_press_off self.printing_press_enabled_for_model = false #self.table_name = self.reset_table_name #self.reset_column_information end |
#printing_press_on ⇒ Object
27 28 29 30 31 |
# File 'lib/printing_press/publishable.rb', line 27 def printing_press_on self.printing_press_enabled_for_model = true #self.table_name = self.published_table_name #self.reset_column_information end |
#publishable(options = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/printing_press/publishable.rb', line 9 def publishable( = {}) send :include, InstanceMethods class_attribute :published_table_name self.published_table_name = [:table_name] || "published_#{table_name}" class_attribute :dependencies self.dependencies = [:dependent_on] || [] class_attribute :printing_press_enabled_for_model end |