Skip to content

Instantly share code, notes, and snippets.

@datt
Last active August 29, 2015 14:19
Show Gist options
  • Select an option

  • Save datt/657c1114ed8687ba45d3 to your computer and use it in GitHub Desktop.

Select an option

Save datt/657c1114ed8687ba45d3 to your computer and use it in GitHub Desktop.
temperory routes and controller for html pages for #FrontEnd. #tmp #controller create a folder named as tmp in views, whatever is the name of the page, can be in accessed from /page_name. e.g. if page name is /help_desk.html.haml, can be accessed as /help_desk
get '/tmp/:page' => 'tmp#index'
get '/tmp/:page/:inner_page' => 'tmp#index'
class TmpController < ApplicationController
skip_before_filter :authenticate_user!
layout :set_layout
def index
if params[:inner_page].present?
render "tmp/#{params[:page]}/#{params[:inner_page]}"
else
render params[:page]
end
end
private
def set_layout
params[:page].include?("admin") ? "admin" : "application"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment