Dear all,
I have a table with a column named “type” and I 'd like to access the
type
field of the correspondant model object but I get a deprecation warning
when
I use the following code :
modelObject.type
“type deprecated use class instead”
How can I access such a named field in rails ?
Johan
Johan Duflost
Analyst Programmer
Belgian Biodiversity Platform ( http://www.biodiversity.be)
Belgian Federal Science Policy Office (http://www.belspo.be )
Tel:+32 2 650 5751 Fax: +32 2 650 5124
On Jan 5, 2006, at 5:29 AM, johan duflost wrote:
How can I access such a named field in rails ?
Johan
Johan Duflost
Analyst Programmer
Belgian Biodiversity Platform ( http://www.biodiversity.be)
Belgian Federal Science Policy Office (http://www.belspo.be )
Tel:+32 2 650 5751 Fax: +32 2 650 5124
Johan-
type is a reserved word in ruby for now. So call your type field
something else like mytype or kind.
Cheers-
-Ezra Z.
Yakima Herald-Republic
WebMaster
http://yakimaherald.com
509-577-7732
[email protected]
On 1/5/06, Ezra Z. [email protected] wrote:
Johan-
type is a reserved word in ruby for now. So call your type field
something else like mytype or kind.
Actually, you can just explicitely define #type and #type= in the model
class.
class Thing < ActiveRecord::Base
def type
read_attribute :type
end
def type=( new_type )
write_attribute :type, new_type
end
end
–
Regards,
John W.
Alice came to a fork in the road. “Which road do I take?” she asked.
“Where do you want to go?” responded the Cheshire cat.
“I don’t know,” Alice answered.
“Then,” said the cat, “it doesn’t matter.”
- Lewis Carrol, Alice in Wonderland