RoR how does scaffold work?

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

anansi wrote, On 4/30/2007 9:40 AM:

     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+migrations

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

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

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

I jackass :slight_smile: thanks of course this solved my problem

Damian wrote:

Damian/Three-eyed Fish


greets

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

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

Yours sincerely,
Damian/Three-eyed Fish

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

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


Giles B.
http://www.gilesgoatboy.org


http://giles.tumblr.com/

Is there at all any Rails newsgroup?!?

Giles B. 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

anansi wrote:

Is there at all any Rails newsgroup?!?

http://www.rubyonrails.org/community

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


Phillip “CynicalRyan” Gawlowski
http://cynicalryan.110mb.com/
http://clothred.rubyforge.org

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

T/

Anansi,

They are calling it a “mailing list” rather than a “newsgroup” on the
Rails site.

The link for that mailing list/newsgroup is
http://groups.google.com/group/rubyonrails-talk

You probably will get better answers there, as it is focused
specifically for Rails, while this is general Ruby (though, I don’t feel
Rails questions are or should be off topic here.)

Regards,

Sam

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

Phillip G. wrote:

anansi wrote:

Is there at all any Rails newsgroup?!?

http://www.rubyonrails.org/community

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

lol there’s a fucking huge difference between a newsgroup and a
mailinglist :wink:

Sammy L. wrote:

anansi wrote:


greets

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

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

Ugh. Lazy, rude and without gratitude. This isn’t your personal
talking
documentation here, this is a group of real people with real things to
do.

I started using Ruby and Rails about a week before you did (I saw you
subscribe to the group), and yet every question you’ve asked I’ve found
in
the documentation, or found by intuitively using search engines (that
‘greatest commercial company on the planet’ also has a very good search
engine). Hell I’ve got 4 healthy Rails projects in development and I’m
already working with other people on them.

My workflow when I need an answer is this:

  1. Look in the documentation. It really never takes me very long to
    click
    through some of the classes at either at http://www.ruby-doc.org/ or
    http://api.rubyonrails.org (usually I start from Base, through the
    Helpers).
    Looking through the source code provided in the API documentation helps
    too.

  2. If I can’t find the information there I’ll search (yes, using
    Google).
    Ruby/Rails users are also pretty heavy bloggers, and 9 times out of 10
    if I
    can’t find what I need in the documentation, I’ll find it in a seach.

  3. Finally, if I really can’t find what I need either in the
    documentation
    or on the web, I’ll consider asking someone. I’ve only had to do this
    once,
    on IRC, and I happened to be there at the time.

I just don’t see the need to post every single question that comes to my
head to this list, and then get picky with the answers. One of the best
ways to learn about something is to pick at it and try things, learning
by
example and trial and error. Your question on increasing the width of a
field for example, I discovered a couple of weeks ago in the API
documentation when I was looking for exactly the same thing. Since my
query
was related to the view, I knew it had something to do with ActionView,
and
I knew it was something to do with forms - so I naturally looked up
ActionView::Helpers::FormHelper, and the answer is right there. As for
partials, I learned about those in the very first screen presentation I
watched (on www.rubyonrails.org).

All I’m saying is, a little bit of time invested on your part saves
everyone
else a little time and irritation.

On 5/3/07, anansi [email protected] wrote:

lol there’s a fucking huge difference between a newsgroup and a
mailinglist :wink:

Well, since this is a mailing list, and you seem only interested in
newsgroups, please kindly go away.
Thanks.

anansi wrote, On 5/3/2007 9:31 AM:

lol there’s a fucking huge difference between a newsgroup and a
mailinglist :wink:

It seems to work about the same way this one does… I figured you
might get better (or at least a larger variety of) answers from
something like this (Ruby-Talk), but more focused on Rails, like
Rails-Talk.

Logan C. wrote:

On 5/3/07, anansi [email protected] wrote:

lol there’s a fucking huge difference between a newsgroup and a
mailinglist :wink:

Well, since this is a mailing list, and you seem only interested in
newsgroups, please kindly go away.

The Curse of the Mirror!

Is it time for the permathread about mirroring the ruby-talk list to
comp.lang and other places?

No?

Good.


James B.

“I never dispute another person’s delusions, just their facts.”

  • Len Bullard

On 2007-05-02 18:25:05 +0900 (Wed, May), anansi wrote:

Is there at all any Rails newsgroup?!?

For quick questions you may want to look at #rubyonrails IRC channel on
irc.freenode.org.

Very helpful.

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