class RenderAnywhere::RenderingController

Public Class Methods

new(*args) click to toggle source

configure the different paths correctly

Calls superclass method
# 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

Public Instance Methods

cookies() click to toggle source

so that your cookies calls still work

# File lib/render_anywhere/rendering_controller.rb, line 64
def cookies
  {}
end
flash() click to toggle source

so that your flash calls still work

# File lib/render_anywhere/rendering_controller.rb, line 49
def flash
  {}
end
params() click to toggle source

and params will be accessible

# File lib/render_anywhere/rendering_controller.rb, line 59
def params
  {}
end
protect_against_forgery?() click to toggle source

we are not in a browser, no need for this

# File lib/render_anywhere/rendering_controller.rb, line 44
def protect_against_forgery?
  false
end
request() click to toggle source

and nil request to differentiate between live and offline

# File lib/render_anywhere/rendering_controller.rb, line 54
def request
  OpenStruct.new
end