you can use alias_method
Julian.
Learn Ruby on Rails! CHECK OUT THE FREE VIDS (LIMITED TIME) VIDEO #3
OUT APRIL 6
http://sensei.zenunit.com/
On 04/04/2008, at 10:40 AM, glasswing28 wrote:
>
> I want to create underscored method alias names for a legacy table ..
>
> Whats the best way to do this ... ?
>
> column_names.each do |name|
> define_method(name.underscore) {self.send(name)}
> define_method(name.underscore+''='') {|a|
self.send(name
> +''='',a)}
> end
>
> >
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---