Scaffold fuction not working properly

Hey guys,
i have just set up a database and ruby on rails application. I then did
a ruby script\generate Product Admin which should give it all of the
nessasary parts to run as a web app. Instead it did this:

C:\ruby\depot>ruby script\generate scaffold Product
exists app/models/
exists app/controllers/
exists app/helpers/
create app/views/products
exists app/views/layouts/
exists test/functional/
exists test/unit/
create app/views/products/index.html.erb
wrong number of arguments (1 for 2)

How can i fix this?
Thanks
Chris

Are you using Rails 2.0?

If so, provide your scaffold with your model’s definition, liike this:
ruby script\generate scaffold Product code:integer name:string

Make sure your you destroy your model first.

I posted something related to this here:

Hope it helps

On Dec 21, 1:56 pm, Chris W. [email protected]

My assumption is that the original poster is trying to follow the Agile
Web
Development with Rails book which is not compatible with Rails 2.0

My suggestion is to uninstall Rails

gem uninstall rails

then reinstall the specific version that will work with that book

gem install version=1.2.6 rails

Then, recreate the depot application

rails depot

That will allow you to complete the book, afterwhich you can upgrade to
Rails 2.0.

Ack… mistake in my commands.

To install Rails 1.2.6, you should do

gem install --version=1.2.6 rails - I forgot the two –

Thanks
You guessed it!
I will do that
Thanks
Chris

On Dec 21, 2007, at 10:56 AM, Chris W. wrote:

C:\ruby\depot>ruby script\generate scaffold Product

You’re leaving out the controller name. If you’re following the book
It should be

ruby script/generate scaffold product admin

I am also having the same problem.

command: ruby script/generate scaffold product admin
the above command creates controller as well as default view.

command: ruby script\generate scaffold Product code:integer name:string
In the above command, I don’t specify controller, so how will the
controller and views will be created?

Thanks.

Vinod

The new scaffolds are RESTful, so they derive their controller name
from the model name (e.g., Product → ProductsController).

Look up information on REST and RESTful Rails for more explanation.

–Jeremy

On Jan 1, 2008 11:24 PM, Vinod J. [email protected]
wrote:

In the above command, I don’t specify controller, so how will the


http://www.jeremymcanally.com/

My books:
Ruby in Practice

My free Ruby e-book

My blogs:

http://www.rubyinpractice.com/

Leonardo wrote:

Are you using Rails 2.0?

If so, provide your scaffold with your model’s definition, liike this:
ruby script\generate scaffold Product code:integer name:string

Make sure your you destroy your model first.

I posted something related to this here:
Leonardo Borges | rails 20 scaffold

Hope it helps

On Dec 21, 1:56�pm, Chris W. [email protected]

You don’t need to destroy the model!

The command:

ruby script\generate scaffold Product

will create a controller called Products. I’m just using that controller
instead of the admin one.

The new version of Rails isn’t actually so different from what I can
see - although i’m still learning also, so I’m open to correction
there…

what the scaffold does now is to generate the view, controller, and
model all in one… it also generates a database migration file (in
the db folder) which can be edited before performing a rake db:migrate
to create the database table with relevant fields… it’s not really
too complex…

Brian H. wrote:

My assumption is that the original poster is trying to follow the Agile
Web
Development with Rails book which is not compatible with Rails 2.0

My suggestion is to uninstall Rails

gem uninstall rails

then reinstall the specific version that will work with that book

gem install version=1.2.6 rails

Then, recreate the depot application

rails depot

That will allow you to complete the book, afterwhich you can upgrade to
Rails 2.0.

I trying to follow the AWDWR 2nd Edition book and I’ve seen your
suggestion in other place too. I can’t see the point though, what is the
point on learning an obsolete version of rails when the new one is
obviously so different! Does anybody know how to work around this
problem with Rails 2.x?