[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Rails: "generate model" with non-standard table name

Robert Eisig

4/17/2006 2:46:00 PM

Hi,

in rails I have to use an existing mysql table named "my_choice". It
does not follow the convention of tables being named plural.

To be able to use the "generate model" script I changed the following
in the file inflections.rb in the active_support lib (almost at the end
of the file):

inflect.uncountable(%w(equipment information [...] sheep my_choice))

I just added the table name at the end. After running the
"script/generate model my_choice" I removed it again.

(This resulted in correctly created files in test and db/migrate)

And then I added a line in the model that was just created:

class MyChoice < ActiveRecord::Base
set_table_name "my_choice"
end

Question: is this a good idea and the best possible way? Could I have
problems with this in the future working with it? How can I do this
easier when it happens again... ain't there a paramter for "generate
model" ? Something like "script/generate model --no-inflect my_choice"?

Thank you
Robert

15 Answers

greg.kujawa

4/17/2006 3:54:00 PM

0

Robert wrote:

> Hi,
>
> in rails I have to use an existing mysql table named "my_choice". It
> does not follow the convention of tables being named plural.
>
>
> To be able to use the "generate model" script I changed the following
> in the file inflections.rb in the active_support lib (almost at the end
> of the file):
>
>
> inflect.uncountable(%w(equipment information [...] sheep my_choice))
>
>
> I just added the table name at the end. After running the
> "script/generate model my_choice" I removed it again.
>
>
> (This resulted in correctly created files in test and db/migrate)
>
>
> And then I added a line in the model that was just created:
>
>
> class MyChoice < ActiveRecord::Base
> set_table_name "my_choice"
> end
>
>
> Question: is this a good idea and the best possible way? Could I have
> problems with this in the future working with it? How can I do this
> easier when it happens again... ain't there a paramter for "generate
> model" ? Something like "script/generate model --no-inflect my_choice"?
>
>
> Thank you
> Robert
>



You might have better results posting this to the Rails mailing list at


http://lists.rubyonrails.org/mailma....

DoD

12/29/2009 7:05:00 AM

0

On Dec 28, 9:56 pm, "iconocl...@yahoo.com" <coaster132...@yahoo.com>
wrote:
> On Dec 28, 9:11 pm, "Fish Supper" <l...@sea.com> wrote:
>
> > "iconocl...@yahoo.com" <coaster132...@yahoo.com> wrote in message
>
> >news:3d848525-7bb8-46d5-934e-e6237b71aa07@r24g2000yqd.googlegroups.com...
>
> > >http://cc.aljazeera.n...
>
> > tell us somethong we don't already know
>
> Fair enough.

LOL!!!!

David

dsharavi

12/29/2009 11:46:00 PM

0

> > > "iconocl...@yahoo.com" <coaster132...@yahoo.com> wrote
> > > >http://cc.aljazeera.n...
>
> > "Fish Supper" <l...@sea.com> wrote:
> > > tell us somethong we don't already know
>
> "iconocl...@yahoo.com" <coaster132...@yahoo.com> wrote:
> > Fair enough.

DoD <danskisan...@gmail.com> wrote:
> LOL!!!!
> David

We should only live so long.

Deborah


HHW

12/29/2009 11:58:00 PM

0

#
Path: textnews.cambrium.nl!feeder3.cambriumusenet.nl!feed.tweaknews.nl!postnews.google.com!v25g2000yqk.googlegroups.com!not-for-mail
From: "iconoclast@yahoo.com" <coaster132000@yahoo.com>
Newsgroups: soc.culture.jewish,soc.culture.israel,soc.culture.palestine,soc.culture.usa
Subject: Re: An army of vandals
Date: Tue, 29 Dec 2009 15:58:13 -0800 (PST)
Organization: http://groups....
Lines: 31
Message-ID: <bd09d32e-1ce5-43e0-9ba5-fafbcc154c35@v25g2000yqk.googlegroups.com>
References: <3d848525-7bb8-46d5-934e-e6237b71aa07@r24g2000yqd.googlegroups.com>
<1pOdnYtQJppv-6TWnZ2dnUVZ8iEAAAAA@bt.com> <7da7e6d3-dbce-45ef-a1d9-14dc8a9edd8c@c34g2000yqn.googlegroups.com>
<ab1ec6cf-8cb1-470f-a8c2-98eb8be57c3c@u7g2000yqm.googlegroups.com>
NNTP-Posting-Host: 201.138.123.41
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1262131093 21430 127.0.0.1 (29 Dec 2009 23:58:13 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Tue, 29 Dec 2009 23:58:13 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: v25g2000yqk.googlegroups.com; posting-host 1.138.123.41;
posting-account=mmj1GgoAAABKBGuuArxYL-f_sz8QLo4W
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.6)
Gecko/20091201 Firefox/3.5.6 (.NET CLR 3.5.30729),gzip(gfe),gzip(gfe)
Xref: textnews.cambrium.nl soc.culture.jewish:859044 soc.culture.israel:980793 soc.culture.palestine:243113 soc.culture.usa:903702

On Dec 29, 2:05 am, DoD <danskisan...@gmail.com> wrote:
> On Dec 28, 9:56 pm, "iconocl...@yahoo.com" <coaster132...@yahoo.com>
> wrote:
>
> > On Dec 28, 9:11 pm, "Fish Supper" <l...@sea.com> wrote:
>
> > > "iconocl...@yahoo.com" <coaster132...@yahoo.com> wrote in message
>
> > >news:3d848525-7bb8-46d5-934e-e6237b71aa07@r24g2000yqd.googlegroups.com....
>
> > > >http://cc.aljazeera.n...
>
> > > tell us somethong we don't already know
>
> > Fair enough.
>
> LOL!!!!
>
> David

So you already know that Israel has committed vast crimes in Gaza?
You've never admitted that before, Toady. For example killing 1,400
people and destroying or damaging 10,000 homes and then refusing to
allow the Palestinians to re-build them. Will you admit these things
again when the subject next arises? You, Toady, are such a strange
humanoid. The objects of your affection don't even respect you.

Tell us, have you read Gilad Atzmon's review of the Coen brother's new
film, "A Serious Man?" It's about life in a Jewish Ghetto in
Minneapolis.

DoD

12/30/2009 5:11:00 AM

0

On Dec 29, 5:46 pm, dsharavi <dshara...@hotmail.com> wrote:
> > > > "iconocl...@yahoo.com" <coaster132...@yahoo.com> wrote
> > > > >http://cc.aljazeera.n...
>
> > > "Fish Supper" <l...@sea.com> wrote:
> > > > tell us somethong we don't already know
>
> > "iconocl...@yahoo.com" <coaster132...@yahoo.com> wrote:
> > > Fair enough.
> DoD <danskisan...@gmail.com> wrote:
> > LOL!!!!
> > David
>
> We should only live so long.

It is really funny watching this so called educated fool reduce
himself to preaching to and highfiving a bunch of
antii-semitic scrounges on usenet. It really is curious that this fool
cant comprehend how ridiculous he looks to
any normal person. I couldn't imagine taking him to a party full of
doctors that I work around and have him start
blathering his bullshit. I am seriously sitting here chuckling at the
thought of something like that. I could just imagine
them asking me off to the side, why I didn't bring him in on a leash.
The guy is a complete loser...and will be one right
up to the bitter end.

Don Ocean

12/30/2009 6:02:00 AM

0

DoD wrote:
> On Dec 29, 5:46 pm, dsharavi <dshara...@hotmail.com> wrote:
>>>>> "iconocl...@yahoo.com" <coaster132...@yahoo.com> wrote
>>>>>> http://cc.aljazeera.n...
>>>> "Fish Supper" <l...@sea.com> wrote:
>>>>> tell us somethong we don't already know
>>> "iconocl...@yahoo.com" <coaster132...@yahoo.com> wrote:
>>>> Fair enough.
>> DoD <danskisan...@gmail.com> wrote:
>>> LOL!!!!
>>> David
>> We should only live so long.
>
> It is really funny watching this so called educated fool reduce
> himself to preaching to and highfiving a bunch of
> antii-semitic scrounges on usenet. It really is curious that this fool
> cant comprehend how ridiculous he looks to
> any normal person. I couldn't imagine taking him to a party full of
> doctors that I work around and have him start
> blathering his bullshit. I am seriously sitting here chuckling at the
> thought of something like that. I could just imagine
> them asking me off to the side, why I didn't bring him in on a leash.
> The guy is a complete loser...and will be one right
> up to the bitter end.

That pretty much sounds like a self description by the inbred Croat
imbecile, DooDooDumbKunt. Is all that Jewish asslicking Kosher for you?
They won't pay your gambling debts or protect you from the crack dealer
that wants to be paid, asshole. Have you explained to the folks here why
you avoid real women like the plague, yet? Whole lot of folks also want
to know when you are going to take a job and stop sponging off the system.

DoD

12/30/2009 6:17:00 AM

0

On Dec 30, 12:01 am, Don Ocean <oc...@hotmail.com> wrote:
> DoD wrote:
> > On Dec 29, 5:46 pm, dsharavi <dshara...@hotmail.com> wrote:
> >>>>> "iconocl...@yahoo.com" <coaster132...@yahoo.com> wrote
> >>>>>>http://cc.aljazeera.n...
> >>>> "Fish Supper" <l...@sea.com> wrote:
> >>>>> tell us somethong we don't already know
> >>> "iconocl...@yahoo.com" <coaster132...@yahoo.com> wrote:
> >>>> Fair enough.
> >> DoD <danskisan...@gmail.com> wrote:
> >>> LOL!!!!
> >>> David
> >> We should only live so long.
>
> > It is really funny watching this so called educated fool reduce
> > himself to preaching to and highfiving a bunch of
> > antii-semitic scrounges on usenet. It really is curious that this fool
> > cant comprehend how ridiculous he looks to
> > any normal person.  I couldn't imagine taking him to a party full of
> > doctors that I work around and have him start
> > blathering his bullshit. I am seriously sitting here chuckling at the
> > thought of something like that. I could just imagine
> > them asking me off to the side,  why I didn't bring him in on a leash.
> > The guy is a complete loser...and will be one right
> > up to the bitter end.
>
> That pretty much

LOLOLOLOLOLOL!!!!!!!! And right on time Donna proves two things for
me... She lives for my every post, popping up
within minutes of me posting to usenet and two, that only losers low
brow dumbasses care for what watson has to say. Especially
one like donna that has a tendency to have friends that "assfuck"
men....

Eeeeyoiiiiiii watson, the company that you highball sippin educated
folk keep....

::::::chuckles:::::::

Oh this can't get much better. Stay real loser....

Don Ocean

12/30/2009 6:27:00 AM

0

DoD wrote:
> On Dec 30, 12:01 am, Don Ocean <oc...@hotmail.com> wrote:
>> DoD wrote:
>>> On Dec 29, 5:46 pm, dsharavi <dshara...@hotmail.com> wrote:
>>>>>>> "iconocl...@yahoo.com" <coaster132...@yahoo.com> wrote
>>>>>>>> http://cc.aljazeera.n...
>>>>>> "Fish Supper" <l...@sea.com> wrote:
>>>>>>> tell us somethong we don't already know
>>>>> "iconocl...@yahoo.com" <coaster132...@yahoo.com> wrote:
>>>>>> Fair enough.
>>>> DoD <danskisan...@gmail.com> wrote:
>>>>> LOL!!!!
>>>>> David
>>>> We should only live so long.
>>> It is really funny watching this so called educated fool reduce
>>> himself to preaching to and highfiving a bunch of
>>> antii-semitic scrounges on usenet. It really is curious that this fool
>>> cant comprehend how ridiculous he looks to
>>> any normal person. I couldn't imagine taking him to a party full of
>>> doctors that I work around and have him start
>>> blathering his bullshit. I am seriously sitting here chuckling at the
>>> thought of something like that. I could just imagine
>>> them asking me off to the side, why I didn't bring him in on a leash.
>>> The guy is a complete loser...and will be one right
>>> up to the bitter end.
>> That pretty much
>
> LOLOLOLOLOLOL!!!!!!!! And right on time Donna proves two things for
> me... She lives for my every post, popping up
> within minutes of me posting to usenet and two, that only losers low
> brow dumbasses care for what watson has to say. Especially
> one like donna that has a tendency to have friends that "assfuck"
> men....

I wasn't aware that anyone I knew, was assfucking you.. Oh? wait a
minute. You are not a man...
>
> Eeeeyoiiiiiii watson, the company that you highball sippin educated
> folk keep....

Is Watson one of those voices in your head?
>
> ::::::chuckles:::::::
>
> Oh this can't get much better. Stay real loser....

I am not the one with loser syndrome.. It is your characteristic right
down to the insane babble to the Watson voice in your head.

Don Kangurin

12/30/2009 6:31:00 AM

0


"Don Ocean" <ocean@hotmail.com> wrote in message
news:7q08meFbn4U1@mid.individual.net...
> DoD wrote:
>> On Dec 29, 5:46 pm, dsharavi <dshara...@hotmail.com> wrote:
>>>>>> "iconocl...@yahoo.com" <coaster132...@yahoo.com> wrote
>>>>>>> http://cc.aljazeera.n...
>>>>> "Fish Supper" <l...@sea.com> wrote:
>>>>>> tell us somethong we don't already know
>>>> "iconocl...@yahoo.com" <coaster132...@yahoo.com> wrote:
>>>>> Fair enough.
>>> DoD <danskisan...@gmail.com> wrote:
>>>> LOL!!!!
>>>> David
>>> We should only live so long.
>>
>> It is really funny watching this so called educated fool reduce
>> himself to preaching to and highfiving a bunch of
>> antii-semitic scrounges on usenet. It really is curious that this fool
>> cant comprehend how ridiculous he looks to
>> any normal person. I couldn't imagine taking him to a party full of
>> doctors that I work around and have him start
>> blathering his bullshit. I am seriously sitting here chuckling at the
>> thought of something like that. I could just imagine
>> them asking me off to the side, why I didn't bring him in on a leash.
>> The guy is a complete loser...and will be one right
>> up to the bitter end.
>
> That pretty much sounds like a self description by the inbred Croat
> imbecile, DooDooDumbKunt. Is all that Jewish asslicking Kosher for you?
> They won't pay your gambling debts or protect you from the crack dealer
> that wants to be paid, asshole. Have you explained to the folks here why
> you avoid real women like the plague, yet? Whole lot of folks also want to
> know when you are going to take a job and stop sponging off the system.

He is a very strange person that dod!

DoD

12/30/2009 6:34:00 AM

0

On Dec 30, 12:26 am, Don Ocean <oc...@hotmail.com> wrote:


> I am not the one with loser syndrome.. It is your characteristic right
> down to the insane babble to the Watson voice in your head

I will let this stand without much comment.. It is just too picture
perfect...

Carry on donna, but by yourself....

LOLOLOLOLOLOLOLOL.....