I have a legacy database which I\'m trying to model using Rails. One of the tables has a column named attributes
, which is a name reserved by Rails I think.
Solved this using a combination of stuff from Robin's link and some other SO answers
class Album < ActiveRecord::Base
set_table_name "album"
class << self
def instance_method_already_implemented?(method_name)
return true if method_name =~ /^attributes/
super
end
end
belongs_to :artist
has_many :tracks, :through => :album_tracks
end
Did the trick. I used a big sweeping change to return true without throwing an error for all methods starting with attributes
, and I don't think its caused any problems elsewhere.