From: dblack@... Date: 2007-08-14T03:24:33+09:00 Subject: Re: attr_read, attr_writer, etc. Hi -- On Tue, 14 Aug 2007, Frank Meyer wrote: > Thanks for your explanation, but how would you write a attr_writer > method? > I don't know how I can pass a parameter list to define_method. Give the block a parameter: def my_attr_writer(*names) names.each do |name| define_method("#{name}=") {|x| instance_variable_set("@#{name}", x) } end end David -- * Books: RAILS ROUTING (new! http://www.awprofessional.com/title/0321509242) RUBY FOR RAILS (http://www.manning.com/black) * Ruby/Rails training & consulting: Ruby Power and Light, LLC (http://www.rubypal.com)