[Rails]Glove.class_name => 'Glofe'

I’m trying to class array to another array.
However Glove.class_name become ‘Glofe’.
Somebody can tell me why?

My environment is ruby 1.8.6 Rails 2.2.2 on Windows Vista.

Hi Masuda,

On Thu, 2009-08-06 at 10:12 +0900, Masuda wrote:

I’m trying to class array to another array.
However Glove.class_name become ‘Glofe’.
Somebody can tell me why?

My environment is ruby 1.8.6 Rails 2.2.2 on Windows Vista.

My first guess would be pluralization.

HTH,
Bill

class_name isn’t a real method, try Glove.class.name instead.

Maurício Linhares
http://codeshooter.wordpress.com/ | http://twitter.com/mauriciojr

Thanks for youre reply but …
Glove.class.name returns “Class”, not a class name.

2009/8/6 Maurício Linhares [email protected]:

Hi Bill.

Thanks for your reply.

I guessed so too, but plural form of glove is ‘gloves’ isn’t it?
In addition, I found Mustache.class_name becomes ‘Mustach’ (lack of last
‘e’).

I think it’s odd.

2009/8/6 bill walton [email protected]:

Ops, i meant Glove.name

Maurício Linhares
http://codeshooter.wordpress.com/ | http://twitter.com/mauriciojr

Thanks for your help.
It works fine !!

2009/8/6 Maurício Linhares [email protected]:

Hi Masuda,

On Thu, 2009-08-06 at 10:55 +0900, Masuda wrote:

Hi Bill.

Thanks for your reply.

You’re welcome. Sorry I couldn’t be more help.

I guessed so too, but plural form of glove is ‘gloves’ isn’t it?
In addition, I found Mustache.class_name becomes ‘Mustach’ (lack of last ‘e’).

I think it’s odd.

It is odd. And yes, the correct plural (in American English) of glove is
gloves. But as you discovered, Rails pluralization is sometimes a bit
‘off’. That’s why I take a look there first when I get weird results
like yours. It’s just a quick way to rule out something simple. Glad
you got the help you needed.

Best regards,
Bill

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