13 Home Page - getfretless/elevennote GitHub Wiki
Home Page
Right now, visiting the application root (/
) will display our rather useless welcome#index
view. Let's edit WelcomeController
to do something a little more sensible.
We'll add the before_action
to redirect unauthenticated users to the login page. We'll send logged in users to new_note_path
.
app/controllers/welcome_controller.rb
class WelcomeController < ApplicationController
before_action :authorize_user
def index
redirect_to new_note_path
end
end
$ git add .
$ git commit -m "Redirect root url depending on logged in status."
We no longer need the welcome#index
view template.
$ git rm app/views/welcome/index.html.erb
$ git commit -m "Remove welcome/index view."