Sha256: 12e9efa5ea6de6ce7c030e0dddd47d346739bf8d0ec7fc3993f4bce4e9a599fb
Contents?: true
Size: 710 Bytes
Versions: 3
Compression:
Stored size: 710 Bytes
Contents
class Cms::PageWorkflow < ActiveRecord::Base self.table_name = 'cms_page_workflows' belongs_to :page, :foreign_key => 'cms_page_id' after_save do |record| record.page.update_attribute(:is_published, record.page_published?) end def self.statuses { 0 => :draft, 1 => :reviewed, # 2 => :scheduled, 3 => :published } end def self.statuses_for_select(can_publish, can_review) ret = [["Draft", 0]] ret << ["Review", 1] if can_review ret << ["Published", 3] if can_publish # self.statuses.map {|k,v| [v.to_s.titleize, k]} ret end def page_published? (status_id.eql?(3) || status_id.eql?(2)) && published_date <= Date.today end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
cms-fortress-1.0.7 | app/models/cms/page_workflow.rb |
cms-fortress-1.0.6 | app/models/cms/page_workflow.rb |
cms-fortress-1.0.5 | app/models/cms/page_workflow.rb |