📄 just_published.rb
字号:
module ContentState class JustPublished < Published include Singleton # We need to save the state as 'Published', but we need after_save # to be handled by JustPublished. So, JustPublished tells Rails that # it's *actually* Published and all shall be well. def memento 'ContentState::Published' end def just_published? true end def just_changed_published_status? true end def published?(content) true end# def enter_hook(content)# super# end# def set_published_at(content, new_time)# super# end def send_notifications(content) content.interested_users.each do |user| content.send_notification_to_user(user) end end def send_pings(content) content.really_send_pings end def withdraw(content) content[:published_at] = nil content.state = Factory.new(:draft) end endend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -