Photo site creation

Photo site creation…

[code]
rails Photos
cd Photos
script/generate model Photo
script/generate model Film
script/generate controller admin/film new create edit update delete show index
script/generate controller admin/photo new create edit update delete show index

mysql -u root
create database photos_dev;
create database photos_test;
grant all on photos_test.* to ‘photos’@’localhost’ identified by ‘**********’;
grant all on photos_dev.* to ‘photos’@’localhost’ identified by ‘**********’;
[/code]

edit config/database.yml to contain the new login and password details.
Edit migration files (consider making filmtype another table rather than a string)
[code]
create_table :photos do |t|
t.column :title, :string
t.column :keywords, :string
t.column :date, :datetime
t.column :film_id, :integer, :null => false
end
[/code]
[code]
create_table :films do |t|
t.column :name, :string
t.column :date, :datetime
t.column :enddate, :datetime
t.column :filmtype, :string
end
[/code]
Add has_many :photos to Film class
Add belongs_to :film to Photo class
********stop, so far taken 1 hour ********************
[code]
script/generate controller admin/filmType new create edit update delete show index
[/code]
modified models accordingly….
********stop, + 15 mins ******************************

  1. One Response to “Photo site creation”

  2. By iain on Nov 15, 2007

    Watch the database names! Rails will create Photos_development not photos_dev.

You must be logged in to post a comment.