From: Bryan Duxbury Date: 2007-08-14T06:26:36+09:00 Subject: Re: Working with classname that is stored in a string Glen Holcomb wrote: > Hi all, One thing you can do is not use a string at all, but pass the class name constant. If you've got a class like: class MyClass ... end then you can do something like: filtered_fields = filter_my_fields MyClass, [:field1, :field2] and it works just fine. Alternatively, you could use an AR extension like this: class ActiveRecord::Base def filtered_fields(*fields) @attributes.reject{|name, value| fields.include?(name.intern)} end end Haven't run that code, but that should let you do something like my_ar_instance.filtered_fields(:field1, :field2) -- Posted via http://www.ruby-forum.com/.