Inflection working everywhere but not propogating to AR table name?

I added this rule to inflections:

inflect.uncountable ‘data’

My table name use to be AuthDatas and I want it to be AuthData. I
migrated
the db to change the table name and verified in the debugger that in
fact
“data”.singularize and “data”.pluralize == ‘data’.

But when I go to load the model:

AuthData

I get the error “AuthData(Table doesn’t exist)”

Am I confused or is something not right? The reason I made the change
was
to make the table name pretty! No other reason.

On 7 May 2011 20:35, David K. [email protected] wrote:

Am I confused or is something not right? The reason I made the change was
to make the table name pretty! No other reason.

“data”.singularize gives me “datum” - which is what it is. Can’t you
change your model to the correct name “AuthDatum”? Then everything
would work as expected.

On 7 May 2011 20:35, David K. [email protected] wrote:

AuthData

I get the error “AuthData(Table doesn’t exist)”

Is that exactly the error you get? Does it not tell you what table
name it is looking for?

The table name should be auth_data if your inflection is working, or
auth_datas if not. You can always use set_table_name if you want to
override the default. Generally life is much simpler if you just
stick to the conventions.

Strictly of course I think the class should be AuthDatum and the table
name auth_data.

Colin

On 7 May 2011, at 20:35, David K. [email protected] wrote:

I added this rule to inflections:

inflect.uncountable ‘data’

My table name use to be AuthDatas and I want it to be AuthData. I migrated the
db to change the table name and verified in the debugger that in fact
“data”.singularize and “data”.pluralize == ‘data’.

But does it singularize/pluralize auth_data correctly?

Fred

On Sat, May 7, 2011 at 2:51 PM, Frederick C.
<[email protected]

wrote:

“data”.singularize and “data”.pluralize == ‘data’.

But does it singularize/pluralize auth_data correctly?

I agree I should be using ‘datum’ for the plural form although I dont
think
that word have ever passed my lips. That aside, what is strange is this:

(rdb:1) “auth_data”.pluralize
“auth_datas”
(rdb:1) “auth_data”.singularize
“auth_datum”
(rdb:1) “data”.pluralize
“datas”
(rdb:1) “data”.singularize
“datum”

So it seems things are reversed. The above is run with no inflection set
by
me.

On 7 May 2011 20:56, David K. [email protected] wrote:

I agree I should be using ‘datum’ for the plural form

Singular.

“datum” is singular, “data” is plural

That aside, what is strange is … it seems things are reversed.

Nothing is strange when you’re inflecting the right way round:

“auth_data”.singularize
=> “auth_datum”

“auth_datum”.pluralize
=> “auth_data”

On Sat, May 7, 2011 at 3:03 PM, Michael P. [email protected]
wrote:

“auth_data”.singularize
=> “auth_datum”

“auth_datum”.pluralize
=> “auth_data”

Thanks Michael and Colin… yeah, so I named the model wrong as datam
was
not in my vocabulary. Now everything works right. I’ll add it to my
debug
checklist to make sure I know the singualar and plurals of the words…

On 7 May 2011 20:56, David K. [email protected] wrote:

inflect.uncountable ‘data’
(rdb:1) “auth_data”.pluralize
“auth_datas”
(rdb:1) “auth_data”.singularize
“auth_datum”
(rdb:1) “data”.pluralize
“datas”
(rdb:1) “data”.singularize
“datum”

Datum is the singular, one datum. Data is the plural, lots of data.
So datum.pluralize is data, data.singularize is datum.

Colin

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