Module: ActsAsStrip::ClassMethods
- Defined in:
- lib/acts_as_strip.rb
Overview
class methods for active record and active model
Instance Method Summary collapse
-
#acts_as_strip(*fields) ⇒ Object
activate gem on ar-model to trim spaces on fields.
Instance Method Details
#acts_as_strip(*fields) ⇒ Object
activate gem on ar-model to trim spaces on fields
Example:
class User < ActiveRecord::Base
acts_as_strip :field1, :field2
end
23 24 25 26 27 28 |
# File 'lib/acts_as_strip.rb', line 23 def acts_as_strip(*fields) include InstanceMethods cattr_accessor :strip_fields self.strip_fields = fields before_validation :strip_fields! if self.respond_to? :before_validation end |