[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

RoR how does scaffold work?

mrpink

4/30/2007 2:36:00 PM

Hi,
I wanna write a little blog in ruby so I started with creating a
mysql-db with blog_test, blog_development, blog_production. Then I
created a new rails project with "rails blog". I create, in the folder
db, a file create.sql with this content:

drop table if exists entrys;

create table entrys (
id int not null auto_increment,
headline varchar(100) not null,
news text not null,
primary key (id)
);

then I did:
mysql blog_development <db/create.sql
which works without problems. After that I changed /config/database.yml:

development:
adapter: mysql
socket: /var/run/mysqld/mysqld.sock
database: blog_development
username: anansi
password:
host: localhost

test:
adapter: mysql
socket: /var/run/mysqld/mysqld.sock
database: blog_test
username: anansi
password:
host: localhost

production:
adapter: mysql
socket: /var/run/mysqld/mysqld.sock
database: blog_production
username: goldstein
password:
host: localhost

because I needed to update the socketline. But if I wanna now scaffold I
get this error :

ruby script/generate scaffold Entry Admin
exists app/controllers/
exists app/helpers/
exists app/views/admin
exists app/views/layouts/
exists test/functional/
dependency model
exists app/models/
exists test/unit/
exists test/fixtures/
identical app/models/entry.rb
identical test/unit/entry_test.rb
identical test/fixtures/entries.yml
error Before updating scaffolding from new DB schema, try
creating a table for your model (Entry)

Can someone tell me what this means? I called the scaffold Entry which
is correctly named for the mysql handling of rails. Why comes this error
and how can I fix it or go around it?

--
greets

(
)
(
/\ .-"""-. / //\\/ ,,, \//\ |/\| ,;;;;;, |/\|
//\\\;-"""-;///\ // \/ . \/ \ (| ,-_| \ | / |_-, |)
//`__\.-.-./__`\ // /.-(() ())-.\ \ (\ |) '---' (| /)
` (| |) `
jgs \) (/


one must still have chaos in oneself to be able to give birth to a
dancing star
15 Answers

Sammy Larbi

4/30/2007 2:45:00 PM

0

anansi wrote, On 4/30/2007 9:40 AM:
> Hi,
> I wanna write a little blog in ruby so I started with creating a
> mysql-db with blog_test, blog_development, blog_production. Then I
> created a new rails project with "rails blog". I create, in the folder
> db, a file create.sql with this content:
>
> drop table if exists entrys;
>
> create table entrys (
> id int not null auto_increment,
> headline varchar(100) not null,
> news text not null,
> primary key (id)
> );
>
> then I did:
> mysql blog_development <db/create.sql
> which works without problems. After that I changed /config/database.yml:
>
>
I think generally, you'll want to use the migrations, as I think that
works some magic on config files which the scaffold command may be
looking for. For more info on migrations, see
http://www.google.com/search?q=ruby+on+rails+...




mrpink

4/30/2007 3:13:00 PM

0

you know what my error belongs to?


--
greets

(
)
(
/\ .-"""-. / //\\/ ,,, \//\ |/\| ,;;;;;, |/\|
//\\\;-"""-;///\ // \/ . \/ \ (| ,-_| \ | / |_-, |)
//`__\.-.-./__`\ // /.-(() ())-.\ \ (\ |) '---' (| /)
` (| |) `
jgs \) (/


one must still have chaos in oneself to be able to give birth to a
dancing star

Damian Terentyev

4/30/2007 3:14:00 PM

0

anansi wrote:
> drop table if exists entrys;
>
> create table entrys (
> id int not null auto_increment,
> headline varchar(100) not null,
> news text not null,
> primary key (id)
> );

Hi!

Rails uses English rules for pluralisation, so the table should be named "entries".
If you're unsure about the form you should use, you can always check from
script/console:
>> "entry".pluralize
=> "entries"

Yours sincerely,
Damian/Three-eyed Fish


mrpink

4/30/2007 3:45:00 PM

0

I jackass :) thanks of course this solved my problem


Damian wrote:
> Hi!
>
> Rails uses English rules for pluralisation, so the table should be named
> "entries".
> If you're unsure about the form you should use, you can always check
> from script/console:
> >> "entry".pluralize
> => "entries"
>
> Yours sincerely,
> Damian/Three-eyed Fish
>


--
greets

(
)
(
/\ .-"""-. / //\\/ ,,, \//\ |/\| ,;;;;;, |/\|
//\\\;-"""-;///\ // \/ . \/ \ (| ,-_| \ | / |_-, |)
//`__\.-.-./__`\ // /.-(() ())-.\ \ (\ |) '---' (| /)
` (| |) `
jgs \) (/


one must still have chaos in oneself to be able to give birth to a
dancing star

Sammy Larbi

4/30/2007 3:52:00 PM

0

anansi wrote, On 4/30/2007 10:15 AM:
> you know what my error belongs to?
>
>

Not sure what this is referring to... could you be more explicit?

Thanks,
Sam


Sammy Larbi

4/30/2007 3:52:00 PM

0


>
> Damian wrote:
>> Hi!
>>
>> Rails uses English rules for pluralisation, so the table should be
>> named "entries".
>> If you're unsure about the form you should use, you can always check
>> from script/console:
>> >> "entry".pluralize
>> => "entries"
>>
>> Yours sincerely,
>> Damian/Three-eyed Fish
>>
>
>

Nice catch Damian, I hadn't even thought to look at the table name!


Giles Bowkett

5/1/2007 1:59:00 AM

0

Now this really is a question for the Rails list, not this list.

--
Giles Bowkett
http://www.gilesg...
http://gilesbowkett.bl...
http://giles.t...


On 4/30/07, anansi <kazaam@oleco.net> wrote:
> Hi,
> I wanna write a little blog in ruby so I started with creating a
> mysql-db with blog_test, blog_development, blog_production. Then I
> created a new rails project with "rails blog". I create, in the folder
> db, a file create.sql with this content:
>
> drop table if exists entrys;
>
> create table entrys (
> id int not null auto_increment,
> headline varchar(100) not null,
> news text not null,
> primary key (id)
> );
>
> then I did:
> mysql blog_development <db/create.sql
> which works without problems. After that I changed /config/database.yml:
>
> development:
> adapter: mysql
> socket: /var/run/mysqld/mysqld.sock
> database: blog_development
> username: anansi
> password:
> host: localhost
>
> test:
> adapter: mysql
> socket: /var/run/mysqld/mysqld.sock
> database: blog_test
> username: anansi
> password:
> host: localhost
>
> production:
> adapter: mysql
> socket: /var/run/mysqld/mysqld.sock
> database: blog_production
> username: goldstein
> password:
> host: localhost
>
> because I needed to update the socketline. But if I wanna now scaffold I
> get this error :
>
> ruby script/generate scaffold Entry Admin
> exists app/controllers/
> exists app/helpers/
> exists app/views/admin
> exists app/views/layouts/
> exists test/functional/
> dependency model
> exists app/models/
> exists test/unit/
> exists test/fixtures/
> identical app/models/entry.rb
> identical test/unit/entry_test.rb
> identical test/fixtures/entries.yml
> error Before updating scaffolding from new DB schema, try
> creating a table for your model (Entry)
>
> Can someone tell me what this means? I called the scaffold Entry which
> is correctly named for the mysql handling of rails. Why comes this error
> and how can I fix it or go around it?
>
> --
> greets
>
> (
> )
> (
> /\ .-"""-. /> //\\/ ,,, \//\> |/\| ,;;;;;, |/\|
> //\\\;-"""-;///\> // \/ . \/ \> (| ,-_| \ | / |_-, |)
> //`__\.-.-./__`\> // /.-(() ())-.\ \> (\ |) '---' (| /)
> ` (| |) `
> jgs \) (/
>
>
> one must still have chaos in oneself to be able to give birth to a
> dancing star
>
>

mrpink

5/2/2007 9:21:00 AM

0

Is there at all any Rails newsgroup?!?

Giles Bowkett wrote:
> Now this really is a question for the Rails list, not this list.
>


--
greets

(
)
(
/\ .-"""-. / //\\/ ,,, \//\ |/\| ,;;;;;, |/\|
//\\\;-"""-;///\ // \/ . \/ \ (| ,-_| \ | / |_-, |)
//`__\.-.-./__`\ // /.-(() ())-.\ \ (\ |) '---' (| /)
` (| |) `
jgs \) (/


one must still have chaos in oneself to be able to give birth to a
dancing star

Phillip Gawlowski

5/2/2007 10:55:00 AM

0

anansi wrote:
> Is there at all any Rails newsgroup?!?

http://www.rubyonrails.org...

Just a guess, but checking a project's / software's website usually
yields such information.

--
Phillip "CynicalRyan" Gawlowski
http://cynicalryan....
http://clothred.rub...

Eek! That was supposed to be My Special Law, _MY_ special law, I tell
you!

T/

mrpink

5/2/2007 11:58:00 AM

0

what you wanna say with this? there's no info about a rails newsgroup on
this website..

Phillip Gawlowski wrote:
> anansi wrote:
>> Is there at all any Rails newsgroup?!?
>
> http://www.rubyonrails.org...
>
> Just a guess, but checking a project's / software's website usually
> yields such information.
>


--
greets

(
)
(
/\ .-"""-. / //\\/ ,,, \//\ |/\| ,;;;;;, |/\|
//\\\;-"""-;///\ // \/ . \/ \ (| ,-_| \ | / |_-, |)
//`__\.-.-./__`\ // /.-(() ())-.\ \ (\ |) '---' (| /)
` (| |) `
jgs \) (/


one must still have chaos in oneself to be able to give birth to a
dancing star