Displaying 1 result from an estimated 1 matches for "old_field_name".
2006 Feb 20
0
Override automatic accessor for reference field in model
...de the automatic accessor by just doing the
following:
def field_name
# do something here
read_attribute(field_name)
end
This does not seem to work for me if the field is an fkey, say user_id,
linking to another table. I''ve made this work by aliasing the accessor
like this:
alias old_field_name field_name
def field_name
#do something
old_field_name
end
This works, but is there a built in function that I need to call to
avoid having to alias this? I''ve tried calling read_attribute(user_id)
and read_attribute(user) - neither works for me.
TIA,
Keith
--
Posted via http://w...