Forum: Ruby on Rails [RoR],[C.L.R] How I convert an AR-Class-name to a symbol?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
51cfbf34cf1f7ebb09c3a717e40c4a85?d=identicon&s=25 Peter Smith (Guest)
on 2007-02-20 21:21
(Received via mailing list)

I'm looking for a method to convert an AR-Class-name to a symbol.

Something like this:

=> :app_server_type

Also I'm looking for this:

=> "AppServerType"

I'm sure this code sits in rails somewhere.

I can see evidence of its use all over the place but
I'm not tuned-in enough to find it.

I tried to find some clues here:

But, I see too much info there.

Bb4bdf2b184027bc38d4fb529770cde5?d=identicon&s=25 Wes Gamble (weyus)
on 2007-02-20 21:56

Check out the Inflector module.

20b1836f8acccd107b4992a1a45a14bd?d=identicon&s=25 chrisfarms (Guest)
on 2007-02-21 00:32
(Received via mailing list)
=> :my_model

=> MyModel

On Feb 20, 8:56 pm, Wes Gamble <>
8da92d4ed91aa12535f6d870fa76b25e?d=identicon&s=25 Aaron (Guest)
on 2007-09-25 23:05
(Received via mailing list)
> I tried to find some clues here:

This is a good place to look too:

Take a look at the to_sym method for the String class and the to_s
method for the Symbol class.

"hello".to_sym => :hello
:hello.to_s => "hello"

51cfbf34cf1f7ebb09c3a717e40c4a85?d=identicon&s=25 Peter Smith (Guest)
on 2007-09-25 23:10
(Received via mailing list)

Now I'm curious about how to change:

Fafe9be2ffb4a3b6bf7fdbf9209da6fa?d=identicon&s=25 Jason Cale (Guest)
on 2007-09-25 23:11
(Received via mailing list)
Hi there..


#=> "app_servers"

close enough.. ?

This topic is locked and can not be replied to.