Sha256: a4bc71542acf5945723a1150fffe41cdaa0dbb7f474e1c7f708747ca9c1e9666
Contents?: true
Size: 1.27 KB
Versions: 1
Compression:
Stored size: 1.27 KB
Contents
require "great_pretender/mockup_locator" require "great_pretender/pretender" module GreatPretender module Controller def self.included(base) base.helper_method :mockup base.helper_method :mockups base.helper_method :mockup_root base.helper GreatPretender::MockupsHelper end def index render template: 'great_pretender/index' end def show if mockup render template: mockup.template, layout: mockup.layout else error_message = I18n.t('great_pretender.not_found') % params[:id] raise ActiveRecord::RecordNotFound.new(error_message) end end private def mockup @great_pretender_mockup ||= mockup_locator.find(params[:id]) end def mockups @great_pretender_mockups ||= mockup_locator.mockups end def mockup_locator @great_pretender_mockup_locator ||= MockupLocator.new(view_paths) end def mockup_root @great_pretender_mockup_root ||= mockup_locator.view_paths.first.join(GreatPretender.config.view_path) end def pretender @great_pretender_pretender ||= Pretender.new(mockup) end def view_context super.tap do |view_context| view_context.extend pretender.to_module if mockup end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
great_pretender-0.1.1 | lib/great_pretender/controller.rb |