Class: RenderAnywhere::RenderingController

Inherits:
ActionController::Metal
  • Object
show all
Includes:
AbstractController::AssetPaths, AbstractController::Helpers, AbstractController::Layouts, AbstractController::Logger, AbstractController::Rendering, AbstractController::Translation, ActionController::Caching, ActionView::Layouts
Defined in:
lib/render_anywhere/rendering_controller.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ RenderingController

configure the different paths correctly



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/render_anywhere/rendering_controller.rb', line 22

def initialize(*args)
  super()

  self.class.send :include, Rails.application.routes.url_helpers

  # this is you normal rails application helper
  if defined?(ApplicationHelper)
    self.class.send :helper, ApplicationHelper
  end

  lookup_context.view_paths = ApplicationController.view_paths
  config.javascripts_dir = Rails.root.join('public', 'javascripts')
  config.stylesheets_dir = Rails.root.join('public', 'stylesheets')
  config.assets_dir = Rails.root.join('public')
  config.cache_store = ActionController::Base.cache_store
  config.relative_url_root = ActionController::Base.relative_url_root

  # same asset host as the controllers
  self.asset_host = ActionController::Base.asset_host
end

Instance Method Details

#cookiesObject

so that your cookies calls still work



64
65
66
# File 'lib/render_anywhere/rendering_controller.rb', line 64

def cookies
  {}
end

#flashObject

so that your flash calls still work



49
50
51
# File 'lib/render_anywhere/rendering_controller.rb', line 49

def flash
  {}
end

#paramsObject

and params will be accessible



59
60
61
# File 'lib/render_anywhere/rendering_controller.rb', line 59

def params
  {}
end

#protect_against_forgery?Boolean

we are not in a browser, no need for this

Returns:

  • (Boolean)


44
45
46
# File 'lib/render_anywhere/rendering_controller.rb', line 44

def protect_against_forgery?
  false
end

#requestObject

and nil request to differentiate between live and offline



54
55
56
# File 'lib/render_anywhere/rendering_controller.rb', line 54

def request
  OpenStruct.new
end