Freshly starting with Rails.. Scaffold issue

I understand that scaffolding has been removed in 2.x but is available
as a generated script.

I’ve generated the scaffold and inserted some data into the DB by hand
(1 record).

The scaffold pages ( http://ruby.geeklan.com/public/products/ ) don’t
show anything and the log file doesn’t indicate anything (useful to me,
anyway, looks successful all the way through).

Am I missing something obvious or is there other information i can
provide?

I’m an experienced PHP Developer (10+ years), but this is totally new to
me. Even the basics barely apply.

Geoff W. wrote:

I understand that scaffolding has been removed in 2.x but is available
as a generated script.

I’ve generated the scaffold and inserted some data into the DB by hand
(1 record).

The scaffold pages ( http://ruby.geeklan.com/public/products/ ) don’t
show anything and the log file doesn’t indicate anything (useful to me,
anyway, looks successful all the way through).

Am I missing something obvious or is there other information i can
provide?

I’m an experienced PHP Developer (10+ years), but this is totally new to
me. Even the basics barely apply.

check if you have a non NULL field in the database.

This is my current table layout:

CREATE TABLE products (
id int(11) NOT NULL auto_increment,
title varchar(100) default NULL,
description text,
image_url varchar(200) default NULL,
price decimal(10,2) default NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

I’d assume this should work, it’s out of the Agile Web Dev w/ Rails book
(Tad old, but I’ve managed to get this far).

Ryan B. wrote:

Your form is empty for your new products link.

That’s what doesn’t make sense to me. I generated this using:

scripts/generate scaffold Product

I would assume the scaffold generation process would take care of the
forms and general format of the page. Is this not true? Seems like that
would defeat the purpose of even offering the ability to generate a
scaffold if it doesn’t actually work.

Looking at the Listing products page which was generated, it has nothing
to show the product fields anywhere.

I added a line as such:

Product ID: <%= product.id %>

And it does print the product ID. This looks like a bug to me. I can
reproduce this when generating the scaffold for any table.

Aha! So you’ve gone script/generate scaffold product!

The correct way is to define which fields you would like defined within
the
scaffold:

script/generate scaffold title:string description:text image_url:string
price:integer
On Dec 12, 2007 10:16 AM, Geoff W. [email protected]
wrote:

) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

I’d assume this should work, it’s out of the Agile Web Dev w/ Rails book
(Tad old, but I’ve managed to get this far).

Posted via http://www.ruby-forum.com/.


Ryan B.
http://www.frozenplague.net

Ryan B. wrote:

Aha! So you’ve gone script/generate scaffold product!

The correct way is to define which fields you would like defined within
the
scaffold:

script/generate scaffold title:string description:text image_url:string
price:integer


Ryan B.
http://www.frozenplague.net

I see now!

Thank you very much, Mr. Bigg! This should help me greatly on my path to
Enlightenment. Enrailsment?

It’s not a bug, it’s a “feature” of Rails 2.0.

I wouldn’t encourage you to use script/generate scaffold anyway.

On Dec 12, 2007 11:16 AM, Geoff W. [email protected]
wrote:

forms and general format of the page. Is this not true? Seems like that
And it does print the product ID. This looks like a bug to me. I can
reproduce this when generating the scaffold for any table.

Posted via http://www.ruby-forum.com/.


Ryan B.
http://www.frozenplague.net

Your form is empty for your new products link.

Are you sure you put the data in the right table?

Try doing <%= Product.count %> which will give a number of how many
records
are in the products table if you have a Product model
On Dec 12, 2007 9:44 AM, Geoff W. [email protected]
wrote:

Am I missing something obvious or is there other information i can
provide?

I’m an experienced PHP Developer (10+ years), but this is totally new to
me. Even the basics barely apply.

Posted via http://www.ruby-forum.com/.


Ryan B.
http://www.frozenplague.net

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs