Hi
From a rails 2.0 tutorial i read when I do ruby script/generate
scaffold Album
then in routes.rb file an entry like
map.resources :albums
be there..I am using rails 1.2.5 but did not see any such entry
after scaffold in routes.rb. Is that happens to rails 2.0 onwards
Hi
Thanks for yur reply.so you are saying that after I do
script/generate scaffold_resource Album then in my routes.rb will
contain
map.resources :albums
Then could you please correct me if anything wrong in the following
steps?(This I am doing for learning REST in Rails)
After creating a rails application I did ruby script/generate model
Item
then in db/migrate/001_create_items.rb I added
t.column :name, :string, :limit=>40 etc and migrated.
Then I did rake db:migrate
After that as you said ruby script/generate scaffold_resource Item
(Hre first I did just scaffold do u remember?)
But at the last line it says that db/migrate create_items already
exists..So surely that step failed Isn't it? And sure there is no change
in routes.rb (As i expect map.resources :items)
Could you please tell me where error happened in my steps?
Hi
Thanks for yur reply.so you are saying that after I do
script/generate scaffold_resource Album then in my routes.rb will
contain
map.resources :albums
Yes - give it a try
Then could you please correct me if anything wrong in the following
steps?(This I am doing for learning REST in Rails)
After creating a rails application I did ruby script/generate model
Item
then in db/migrate/001_create_items.rb I added
t.column :name, :string, :limit=>40 etc and migrated.
Then I did rake db:migrate
After that as you said ruby script/generate scaffold_resource Item
(Hre first I did just scaffold do u remember?)
But at the last line it says that db/migrate create_items already
exists..So surely that step failed Isn't it? And sure there is no change
in routes.rb (As i expect map.resources :items)
Ah, that's because scaffold_resource creates the model for you as
well. If you already have a model, pass --skip to make it not
overwrite your files.
Also, it's not obvious, but you can start up any generator without any
parameters to get help on it, for example:
script/generate scaffold
This will emit a short list of options you can use with the scaffold
generator.