How do I do this for models?

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 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/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs