Sha256: 29c1e28bc2739c552c1e567475217b87e356680234377fae3d484153d9d3d1b9

Contents?: true

Size: 496 Bytes

Versions: 6

Compression:

Stored size: 496 Bytes

Contents

module Shakespeare
  module Helpers
    def self.included(base)
      if base.respond_to?(:helper_method)
        base.send(:helper_method, :page_content, :protect_in_production)
      end
    end
  
    def page_content
      @page_content = Page.find_by_url("#{controller_name}/#{action_name}")
    end
    
    def protect_in_production
      return true unless Shakespeare.env == 'production'
      render :text => 'Unauthorized' unless Shakespeare::Settings.allow_anonymous
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
shakespeare-0.3.4 lib/shakespeare/helpers.rb
shakespeare-0.3.2 lib/shakespeare/helpers.rb
shakespeare-0.3.1 lib/shakespeare/helpers.rb
shakespeare-0.3.0 lib/shakespeare/helpers.rb
shakespeare-0.2.2 lib/shakespeare/helpers.rb
shakespeare-0.2.1 lib/shakespeare/helpers.rb