search for: attribute_to_strip

Displaying 1 result from an estimated 1 matches for "attribute_to_strip".

2007 Dec 13
2
automatically strip values of activerecord attributes
i am doing a couple of times the following in my models class User < ActiveRecord::Base def name=(val) write_attribute :name, val.to_s.strip end end quite clear, it strips the name when setting it. now the question: Is it possible to do something like the following .. and if yes how could i achieve it class User < ActiveRecord::Base auto_strip :name, :street end thanks... --