Rails 2.0.2 Scaffold NOT creating new stuff

I am running 2.0.2 on a windows machine.

I created a new project.

Used the new generate scaffold to create a MVC for “Song”. That
worked.

However when I tried to create scaffold for the next file, “Content” I
get NO views/models/controller …

Here is the command I am using.

E:\RubyProjects\crmusic\rails script/generator scaffold Content
songs_id:integer contentype:string filename:string size:integer
content_type:integer

I run this and it creates all of the base structures but does NOT
create the MVC for “Content”.

I am sure that I am doing something silly, but do not see what it is.

Any help would be appreciated.

HI,

Rails 2.0 does not have the scaffold package, you should install it by
hand.

See http://activescaffold.com/

Cheers,
Pablo.-

Rails 2.0 does have the scaffold package. In fact, it now scaffolds
REST compatible resources (previously known as scaffold_resource in
Rail 1.2).

It seems your command is wrong. It’s script/generate, not script/
generator. Also, since you’re on windows, you have to specify ‘ruby’
before the command.

F:\code\test>ruby script/generate scaffold Content songs_id:integer
contentype:string filename:string size:integer content_type:integer
exists app/models/
exists app/controllers/
exists app/helpers/
create app/views/contents
exists app/views/layouts/
exists test/functional/
exists test/unit/
create app/views/contents/index.html.erb
create app/views/contents/show.html.erb
create app/views/contents/new.html.erb
create app/views/contents/edit.html.erb
create app/views/layouts/contents.html.erb
create public/stylesheets/scaffold.css
dependency model
exists app/models/
exists test/unit/
exists test/fixtures/
create app/models/content.rb
create test/unit/content_test.rb
create test/fixtures/contents.yml
create db/migrate
create db/migrate/001_create_contents.rb
create app/controllers/contents_controller.rb
create test/functional/contents_controller_test.rb
create app/helpers/contents_helper.rb
route map.resources :contents

Ian,

You are right, I missunderestood the question.

Sorry.

Ian,

THANKS !!!

This is an amazing list. Thank you for taking the time to response.

It worked, now I can get on to more rails 2.0 learing here

I have created a screencast that is updated version of onlamp.com
Rolling
With Rails for Rails 2.0, check it out:
Rolling with Ruby on Rails Revised - Rails 2.0

You can now learn Rails 2.0 from here too! Enjoy.

On Dec 27, 2007 1:41 AM, Bartee L. [email protected]
wrote:

Ian,

THANKS !!!

This is an amazing list. Thank you for taking the time to response.


http://www.rubyplus.org/
Free Ruby and Rails Screencasts

i’m running into a similar problem now, having upgraded to rails
2.0.2. I ran the scaffold command, and i get the views, but it’s not
generating the controller. has anyone else seen this?

Thanks,
John

http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/864adb5cc95c1cff/c0cfbaa0c8388467?lnk=st&q=#c0cfbaa0c8388467

On Feb 22, 3:26 pm, Mark B. [email protected]

Why the new version of scaffold read the table from the database and
add the filed to the model/*.html.erb?

So I have to add every single fileds/types in the command line??

johnrails wrote:

i’m running into a similar problem now, having upgraded to rails
2.0.2. I ran the scaffold command, and i get the views, but it’s not
generating the controller. has anyone else seen this?

Yes. This happened to me once, then I checked the output of the
generator and saw that it had crapped out creating the model because I’d
already done that. If you look at the list it should go something like
this (from Zabel’s post):

  create    app/models/content.rb
  create    test/unit/content_test.rb
  create    test/fixtures/contents.yml
  create    db/migrate
  create    db/migrate/001_create_contents.rb
  create  app/controllers/contents_controller.rb

so if it bombs at the model, it won’t create the controller.

Possibly your problem?

I’d have hoped the generator would have accepted that the model already
existed and continued. The rails 1.2 scaffolder managed this if I
remember rightly…