You can use the attributes hash to access the columns (model[:notify]
works too), and create getter/setter methods like notify_column() and
notify_column=() to get around the naming clash.
True, but I don't even want to touch the notify column, the problem
happens when I access another column/attribute and then try to save
the record. The Model#notify method is created as soon as I touch the
model in any way (even just to re-save it w/o any changes in
attributes) and it's during the save process that the Model#notify
method is called, this time with an argument which, of course is a
problem since the notify method is now defined with no arguments:
r=RegressionData.find(:first)
=> #<RegressionData ID: 681, status: "N/A", notify: "", num_wpnts: 0,
num_bpnts: 0>
r.save
ArgumentError: wrong number of arguments (1 for 0)
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3.7116/lib/
active_record/callbacks.rb:332:in `notify'
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3.7116/lib/
active_record/callbacks.rb:332:in `callback'
...
So without touching the object I cannot save it.
The ActiveRecord::Base API lives in the same namespace as the
attributes of model classes. That means there can be occasional
clashes. One way to deal with that is to always enforce a separation
of namespaces, but that makes the API more heavyweight. ActiveRecord
strikes a pretty good balance between making the API lightweight, and
allowing you a second way to access attributes when there are name
clashes.
I'd like AR to allow me to turn off the possibility of clashing (on
certain models
and only be able to use the second way to access
attributes.
By the way, this list is not for support issues. Those should be sent
to rubyonrails-talk@googlegroups.com.
I appreciate that point and your response to my point. Is this not a
core issue to legacy database support though?
BTW, nobody has made any comment to the same issue posted on the
rubyonrails-talk group, I guess it's just me being dumb or unlucky!
Thanks,
Allan