/をtweets#indexに変更
deviseをインストール

Gemfileを修正後、bundle install

$ bundle install
Resolving dependencies...
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.7.9)
Using atomic (1.1.13)
Using thread_safe (0.1.2)
Using tzinfo (0.3.37)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using mime-types (1.25)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.0)
Using activemodel (4.0.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.0)
Using activerecord (4.0.0)
Using bcrypt-ruby (3.1.1)
Using sass (3.2.10)
Using bootstrap-sass (2.3.2.2)
Using bundler (1.3.5)
Using coffee-script-source (1.6.3)
Using execjs (2.0.1)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0)
Using coffee-rails (4.0.0)
Using orm_adapter (0.4.0)
Using warden (1.2.3)
Using devise (3.0.2)
Using hike (1.2.3)
Using jbuilder (1.5.1)
Using jquery-rails (3.0.4)
Using json (1.8.0)
Using tilt (1.4.1)
Using sprockets (2.10.0)
Using sprockets-rails (2.0.0)
Using rails (4.0.0)
Using rdoc (3.12.2)
Using sass-rails (4.0.0)
Using sdoc (0.3.20)
Using sqlite3 (1.3.8)
Using turbolinks (1.3.0)
Using uglifier (2.2.1)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
アプリケーションにdeviseをインストール

$ rails generate devise:install
      create  config/initializers/devise.rb
      create  config/locales/devise.en.yml
===============================================================================

Some setup you must do manually if you haven't yet:

  1. Ensure you have defined default url options in your environments files. Here
     is an example of default_url_options appropriate for a development environment
     in config/environments/development.rb:

       config.action_mailer.default_url_options = { :host => 'localhost:3000' }

     In production, :host should be set to the actual host of your application.

  2. Ensure you have defined root_url to *something* in your config/routes.rb.
     For example:

       root :to => "home#index"

  3. Ensure you have flash messages in app/views/layouts/application.html.erb.
     For example:

       <p class="notice"><%= notice %></p>
       <p class="alert"><%= alert %></p>

  4. If you are deploying on Heroku with Rails 3.2 only, you may want to set:

       config.assets.initialize_on_precompile = false

     On config/application.rb forcing your application to not access the DB
     or load models when precompiling your assets.

  5. You can copy Devise views (for customization) to your app by running:

       rails g devise:views

===============================================================================
ジェネレーターでUesrモデルを生成

$ rails generate devise User
      invoke  active_record
      create    db/migrate/20130920003112_devise_create_users.rb
      create    app/models/user.rb
      insert    app/models/user.rb
       route  devise_for :users
データベースをマイグレーション

$ rake db:migrate
==  DeviseCreateUsers: migrating ==============================================
-- create_table(:users)
   -> 0.0085s
-- add_index(:users, :email, {:unique=>true})
   -> 0.0008s
-- add_index(:users, :reset_password_token, {:unique=>true})
   -> 0.0005s
==  DeviseCreateUsers: migrated (0.0100s) =====================================
コンフィグファイルにdeviseの設定を追記
ログインしているとき、ヘッダーにメールアドレスを表示
メールアドレスを右寄せに変更
Tweetモデルにuser_idを追加するマイグレーションスクリプトを生成

$ rails generate migration AddUserIdToTweet user_id:integer
      invoke  active_record
      create    db/migrate/20130920005541_add_user_id_to_tweet.rb
説明を追記
マイグレーションスクリプトを実行

$ rake db:migrate
==  AddUserIdToTweet: migrating ===============================================
-- add_column(:tweets, :user_id, :integer)
   -> 0.0073s
==  AddUserIdToTweet: migrated (0.0074s) ======================================
リレーションシップを定義
tweetしたときにuserに紐付ける
非ログイン状態の時はログインページにリダイレクトされるように変更
非ログイン状態の時はtweetフォームを出ないように変更
Merge pull request #1 from ytkt/day2

Day2