Skip to content

Instantly share code, notes, and snippets.

@spencereldred
Last active August 29, 2015 14:00
Show Gist options
  • Save spencereldred/11152454 to your computer and use it in GitHub Desktop.
Save spencereldred/11152454 to your computer and use it in GitHub Desktop.
Rails Views and Controllers Lesson

Rails Views and Controllers Lesson

  • Today we are going to review a completed rails app: Todo App.

  • Todo App is a complete implementation of a CRUD.

  • The morning we will review the Todo App in detail.

  • The afternoon lesson will be a code along to create the Todo App.

We will analyze the todo_app in detail

  • We will follow how the Views and the Controller communicate together.

    *

    We will follow a typical rails code development sequence.

  • We will learn some Rails commands used in the view

    *

    form_for, link_to, button_to

  • Our focus will be on Views and Controllers. Of course we will need to have routes.

  • The database model code is stubbed out for us. We will leave the detailed discussion of the database creation and commands for tomorrows lesson.

Learning Objectives

At the end of the lesson, you should be able to:

*

1) Set up restful routes.

*

2) Set up a controller to interact with index, show, new, and edit pages.

*

3) Know what to implement on each view page (index, show, new, and edit).

*

4) How to setup and use a form_for, button_to and link_to rails commands.

*

5) How to set up Bootstrap in a rails app.

Get the completed todo_app. Clone it to your desktop.

###Todo App

Action: Run bundle install.

Action: Prepare the database

# migrate the database
bundle exec rake db:migrate

# seed the database
bundle exec rake db:seed

Action: Go to your terminal and start the server.

# start the server
rails s

We begin the review!

Rails helper commands:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment