automatically strip values of activerecord attributes

This should do the trick:

class User < ActiveRecord::Base

   def self.auto_strip(*args)      args.each do |attribute_to_strip|        class_eval <<-RUBY          def #{attribute_to_strip.to_s}=(value)            write_attribute :#{attribute_to_strip.to_s}, value.strip          end        RUBY      end    end

   auto_strip :name, :street end