Skip to content

Instantly share code, notes, and snippets.

@pauldatta
Created December 31, 2012 13:00
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pauldatta/4419597 to your computer and use it in GitHub Desktop.
Save pauldatta/4419597 to your computer and use it in GitHub Desktop.
Using Rabl with Grape Trying to get view helpers to work within Rabl templates that are called from Grape. @pauldatta
# https://github.com/drapergem/draper/wiki/Using-Rails-Path-Helpers-in-Draper-Decorators-with-Grape
# https://github.com/nesquena/rabl/wiki/Using-Rabl-with-Grape
module Grape
class Endpoint
include Rails.application.routes.url_helpers
default_url_options[:host] = ::Rails.application.routes.default_url_options[:host]
end
end
module Rabl
class Engine
# Access Application Helpers
include ActionView::Helpers::ApplicationHelper
include Rails.application.routes.url_helpers
default_url_options[:host] = ::Rails.application.routes.default_url_options[:host]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment