Starter Application for Final Project
Install Ruby via RailsInstaller (install latest version)
bundle install --without production
Install the rerun gem: gem install rerun
rerun 'bundle exec ruby app.rb'
Authentication System: "/login", "/logout", "/sign_up"
User model
Bootstrap
I have created a helper method authenticate!
which, when called, will redirect the user to the sign in page if they are not signed in. This will help you protect pages that should only be accessed by signed in users.
To define a URL in which the person must be signed in to view, use the authenticate!
method.
For example:
get "/dashboard" do
authenticate!
erb :dashboard
end
To get information about the current signed in user, use the current_user
method which returns the user object of the current signed in user or nil
if no one is signed in.
In a template:
Hello <%= current_user.email %>
In code:
get '/say_hello' do
if current_user
return "Hello #{current_user.email}!"
else
return "Hello World!"
end
end
heroku create
heroku addons:create heroku-postgresql:hobby-dev
git push heroku master