Module: AlmostHappy::Convertable::ClassMethods
- Defined in:
- lib/almost_happy/convertable.rb
Instance Method Summary collapse
Instance Method Details
#validate_convertable_format(*attrs) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/almost_happy/convertable.rb', line 15 def validate_convertable_format(*attrs) if attrs.empty? attrs = [:format] else attrs = attrs.map { |a| a.to_s.gsub(/(_format)?$/, '_format').to_sym } end validates_presence_of *attrs validates_with AlmostHappy::FormatValidator, :attributes => attrs end |