Skip to content

Instantly share code, notes, and snippets.

@ryansmith3136
Created April 30, 2013 23:47
Show Gist options
  • Select an option

  • Save ryansmith3136/5492770 to your computer and use it in GitHub Desktop.

Select an option

Save ryansmith3136/5492770 to your computer and use it in GitHub Desktop.
E.g. Rendering a rails view outside of the controller.
def render_html
dir = Rails.root.join("app", "views", "users")
view = ActionView::Base.new(dir, :user => @user)
view.extend(ApplicationHelper)
view.render(file: 'show', layout: '../layouts/application.html.erb')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment