Skip to content

Instantly share code, notes, and snippets.

@edgarv09
Created January 6, 2021 15:06
Show Gist options
  • Save edgarv09/bb8e3ddbf6679406d394004773a1d25b to your computer and use it in GitHub Desktop.
Save edgarv09/bb8e3ddbf6679406d394004773a1d25b to your computer and use it in GitHub Desktop.
render in rails console

initial setup

view_paths = Rails::Application::Configuration.new(Rails.root).paths["app/views"] av_helper = ActionView::Base.new view_paths

(Optional) include this if your partial uses route helpers:

include Rails.application.routes.url_helpers

av_helper.render "path/to/your/partial"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment