Skip to content

kanaadp/RailsDecal

Repository files navigation

Lecture 7: Idea to App

This week, we take an idea and turn it into an app. You can see the changes made in code for every step in the lecture notes as follows:

Initial app - https://github.com/rails-decal/fa15-lecture7


Step 1: User/Post models

rails generate model User
rails g model Quit # g is an alias for generate
# Edit migration files
rake db:migrate
annotate # Generates helpful schema info in model files

Step 1 Code


Step 2: User auth

gem 'devise' # In Gemfile, not typed in terminal
bundle install
rails generate devise:install
rails generate devise User
rake db:migrate
annotate

Step 2 Code


Step 3: Validations + Associations

# Add validations
rails g migration AddUserIdToQuits
# Edit migration
rake db:migrate
annotate
# Add validation for user_id

Step 3 Code


Step 4: Seeds, routes, user show, user index

# Add routes
rake routes # To review the routes you made
# Make app/controllers/users_controller.rb, app/views/users/show.html.erb
# Edit db/seeds.rb
rake db:setup

Step 4 Code


Step 5: Edit, update Quit

Step 5 Code


Step 6: New, create Quit

Step 6 Code

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published