Module: StripAttribute

Extended by:
ActiveSupport::Concern
Included in:
Issuable, Milestone
Defined in:
app/models/concerns/strip_attribute.rb

Overview

Strip Attribute module

Contains functionality to clean attributes before validation

Usage:

class Milestone < ActiveRecord::Base
  strip_attributes :title
end

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#strip_attributesObject


29
30
31
32
33
# File 'app/models/concerns/strip_attribute.rb', line 29

def strip_attributes
  self.class.strip_attrs.each do |attr|
    self[attr].strip! if self[attr] && self[attr].respond_to?(:strip!)
  end
end