Cryptocurrency Thoughts
  • Behavioural Bitcoin Report
  • Mailing list

Multiple routes in Rails 4- Different homepage views for signed in users vs new visitors

1/29/2016

0 Comments

 
Rails 4 does not allow you to create 2 roots in your routes file, unless you modify one of them as authenticated. I have included a simple example below as extracted from the Mackenzie Child Notebook application. Sytax is in italics :

​Rails.application.routes.draw do
  devise_for :users
  get 'welcome/index'
  resources :notes

  authenticated :user do
      root 'notes#index', as: "authenticated_root"
  end


  root 'welcome#index'
  
end
0 Comments



Leave a Reply.

    Categories

    All
    Best
    Links

    Archives

    February 2017
    December 2016
    November 2016
    October 2016
    September 2016
    June 2016
    April 2016
    March 2016
    January 2016
    November 2015
    October 2015
    September 2015
    July 2015
    May 2015

    Author

    Veteran, Beginner Programmer. Mainly Ruby and Javascript.

    RSS Feed

Proudly powered by Weebly