Class: Alchemy::Current

Inherits:
ActiveSupport::CurrentAttributes
  • Object
show all
Defined in:
app/models/alchemy/current.rb

Instance Method Summary collapse

Instance Method Details

#languageObject



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

Returns:

  • (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

#siteObject



9
10
11
# File 'app/models/alchemy/current.rb', line 9

def site
  super || Site.first
end