generate scaffold album

$rails g scaffold album title:string user_id:integer
Album has_many Photos and belongs_to User

-add album_id to photo
* $ rails g migration add_album_id_to_photos
* migration code
* add_column
* add_index
* Photo model __/ attr_accessible :album_id

-Album model __/
* has_many :photos, dependent: :destroy
* belongs_to :user

-Photo model __/
* belongs_to :album

-User model __/
* has_one :album, dependent: :destroy
* accepts_nested_attributes_for :album
* has_many :photos, through: :album
* accepts_nested_attributes_for :photos

$ rake db:migrate