*** *** ** ** ** ** * * * * * * * ** ** ** ** ** ** * ____ _ _ ____ _ _ | _ \ __ _(_) |___ / ___(_)_ __| |___ | |_) / _` | | / __| | | _| | '__| / __| | _ < (_| | | \__ \ | |_| | | | | \__ \ |_| \_\__,_|_|_|___/ \____|_|_| |_|___/
We’re going to develop a simple bookmarks sharing app. People will be able to signup/signin, add their bookmarks and fork others :-)
See finished work in action: rgr13-bookmarks.herokuapp.com.
-
add devise gem and run setup scripts
> rails generate devise:install > rails generate devise User
-
add ‘username’ attribute to devise migration
-
remove ‘recoverable’ and ‘confirmable’ stuff from devise migration
-
validating presence and uniqueness of username in User model
-
generate views, add username field to signup form
> rails g devise:views
-
run migration
> rake db:migrate
-
go to /users/sign_up
-
run rails console
> rails c -> User.all
-
generate scaffold for Bookmark resource
> rails g scaffold bookmark title url user_id:integer > rake db:migrate
-
add validations and relations between User and Bookmark
-
require User authentication to manage Bookmark
-
order Bookmark by descending creation date
-
integrate Twitter Bootstrap by installing bootstrap-sass gem
-
add prettier styles and remove css scaffold
-
add home page with all bookmarks
-
show User’s bookmarks in bookmarks index page
-
add public User profile
-
remove #show action for Bookmark
-
views
-
controller
-
-
add pagination
-
add kaminari gem
> rails generate kaminari:config
-
add pagination to index pages
-
adapt pagination to bootstrap
> rails generate kaminari:views bootstrap
-
-
add postgresql gem for production
-
setup Puma web server
-
add Procfile: web: bundle exec rails server puma -p $PORT -e $RACK_ENV
-
add .env: set RACK_ENV and RAILS_ENV to development
-
-
prevent environment to be loaded during assets precompile:
-
add “config.assets.initialize_on_precompile = false” to config/application.rb
-
-
create heroku app:
> heroku create rgr13-yourname-bookmarks
-
improve html and css (show finished work)
-
use username instead of id in public User profile url
-
handle profile not found error (redirect to profiles path with an alert notice)
-
add prettier tables to show Bookmarks
-
fork Bookmarks
* heroku apps:create rgr13-bookmarks-<developer name> * ssh keygen -t rsa * heroku keys:add ~/.ssh/id_rsa.pub * git push heroku master