PAPER - work out what form all of your data will take- tables and field names
TERMINAL - rails new NAME -d postgresql
TERMINAL - cd into that NAME folder and subl .
SUBL - open your gemfile and add all the extra gems you want
TERMINAL - bundle
SUBL - database.yml - update with db user name
TERMINAL - rake db:create
TERMINAL - rails generate migration create_artists (this will create a table migration for the artists table)
SUBL - db/migrate - you will now see your migration file created (in this case - for CreateArtists)
SUBL - in the migration file add all of your fileds for that table
TERMINAL - rake db:migrate - you can check this has worked by going into SUBL - db/schema
TERMINAL - rails generate migration create_works - create the next table (works)
SUBL - again - go in and create all of your table field references eg.
t.text :title t.integer :year t.text :medium t.string :style t.text :image t.timestamps
TERMINAL - rake db:migrate (second time - to create second table) - you can check this has worked by going into SUBL - db/schema
SUBL - now build models in the app/models folders - one file per model, MUST be named as a singular version of the table name
TERMINAL - you can now run 'annotate' which will update your model file with annotated info
TERMINAL (new tab) - open 'rails console' and you can now start to query your tables to see that everything is there eg. artist = Artist.new
SUBL - db/migrate/seeds.rb - create your seed file eg.
Artist.destroy_all
Artist.create(:name => 'Joan Miro', :nationality => "Spanish", :dob => '1983/04/20', :period => '20th century', :image => 'image URL' ) (repeat this as many times as you wish)
TERMINAL - rake db:seed will load your seed file ##if you are using the protected_attributes gem you will need to add attr_accessible to your model
TERMINAL(rails terminal) - you can check that the seeding worked with 'Artist.all'
SUBL - config/routes - you can just add 'resources :artists' to get all of the CRUD routes generated
TERMINAL - 'rake routes' will always tell you what routes (roots :) you have setup
TERMINAL (cheat!)- 'rails generate controller Artists index create new edit show update destroy' will generate all of the controllers and views for you!
TERMINAL (new tab) 'rails server' now you can open localhost/3000 to see your app
SUBL - now you can start adding in actions down the list on the controllers page. you will also create the views at this time.
HAPPY FREAKING DAYS!
then to really blow you rmind - active record migration to add works to artists...
TERMINAL rails generate migration add_artist_id_to_works artist_id:integer
TERMINAL rake db:migrate
TERMINAL annotate (so the new column appears within the model notes)
now just add your belongs_to and has_many associations and you're set!!