Class: Alchemy::Current
- Inherits:
-
ActiveSupport::CurrentAttributes
- Object
- ActiveSupport::CurrentAttributes
- Alchemy::Current
- Defined in:
- app/models/alchemy/current.rb
Instance Method Summary collapse
- #language ⇒ Object
- #preview_page=(page) ⇒ Object
- #preview_page?(page = Current.page) ⇒ Boolean
- #site ⇒ Object
Instance Method Details
#language ⇒ Object
5 6 7 |
# File 'app/models/alchemy/current.rb', line 5 def language super || Language.default end |
#preview_page=(page) ⇒ Object
13 14 15 16 17 18 19 |
# File 'app/models/alchemy/current.rb', line 13 def preview_page=(page) super self.page = page self.language = page&.language self.site = page&.site end |
#preview_page?(page = Current.page) ⇒ Boolean
21 22 23 24 |
# File 'app/models/alchemy/current.rb', line 21 def preview_page?(page = Current.page) return false if preview_page.nil? preview_page == page end |
#site ⇒ Object
9 10 11 |
# File 'app/models/alchemy/current.rb', line 9 def site super || Site.first end |