Skip to content

Instantly share code, notes, and snippets.

@clowder
Created July 16, 2015 11:03
Show Gist options
  • Save clowder/2202afd9efdf37aa6923 to your computer and use it in GitHub Desktop.
Save clowder/2202afd9efdf37aa6923 to your computer and use it in GitHub Desktop.
Admin preview user content
class Admin::SpacesController < AdminController
def preview
space = Space.find(params[:id])
prepend_view_path 'app/views/spaces' # Ensures our `:template` is found.
lookup_context.prefixes = ['spaces', 'application'] # Ensures that our templates partials are pulled from the right places.
render template: 'show', layout: 'application', locals: { space: space }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment