On Feb 12, 2:13 pm, Jim <[email protected]> wrote:
> Although, I have to wonder if there's a better way to
> accomplish this than through method_missing. Maybe there's some way
> to loop through all attributes and call alias_attribute dynamically
> when classes are loaded?
>
There is - try this:
class LegacyModel < ActiveRecord::Base
column_names.each do |c|
# figure out the new name
alias_attribute new_name, c
end
end
--Matt Jones
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---