⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 publication_pending.rb

📁 用ruby on rails写的一个博客程序,还不错..ruby on rails的确是个好框架
💻 RB
字号:
module ContentState  class PublicationPending < Base    include Singleton    def enter_hook(content)      super      content[:published] = false if content.new_record?    end    def change_published_state(content, published)      content[:published] = published      if published && content.published_at <= Time.now        content.state = JustPublished.instance      end    end    def set_published_at(content, new_time)      content[:published_at] = new_time      Trigger.remove(content, :trigger_method => 'publish!')      if new_time.nil?        content.state = Draft.instance      elsif new_time <= Time.now        content.state = JustPublished.instance      end    end    def publication_pending?      true    end    def post_trigger(content)      Trigger.post_action(content.published_at, content, 'publish!')    end    def withdraw(content)      content[:published_at] = nil      content.state = Draft.instance    end  endend

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -