Module: Shakespeare::Helpers

Defined in:
lib/shakespeare/helpers.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
6
7
# File 'lib/shakespeare/helpers.rb', line 3

def self.included(base)
  if base.respond_to?(:helper_method)
    base.send(:helper_method, :page_content, :protect_in_production)
  end
end

Instance Method Details

#page_contentObject



9
10
11
# File 'lib/shakespeare/helpers.rb', line 9

def page_content
  @page_content = Page.find_by_url("#{controller_name}/#{action_name}")
end

#protect_in_productionObject



13
14
15
16
# File 'lib/shakespeare/helpers.rb', line 13

def protect_in_production
  return true unless Shakespeare.env == 'production'
  render :text => 'Unauthorized' unless Shakespeare::Settings.allow_anonymous
end