Class: Decidim::Attributes::CleanString

Inherits:
ActiveModel::Type::Value
  • Object
show all
Defined in:
lib/decidim/attributes/clean_string.rb

Overview

Custom attributes value to “standardize” the newline characters within strings that are sent through user entered forms. This strips out the carriage return characters from the strings in order to avoid validation mismatches with the string lengths between the frontend and the backend.

This type should be used with forms that have:

  • A user input defined with the <textarea> element

  • The input element having the ‘maxlength` attribute defined for it

  • The backend having a maximum length validation for the input

Instance Method Summary collapse

Instance Method Details

#typeObject

:nodoc:



15
16
17
# File 'lib/decidim/attributes/clean_string.rb', line 15

def type # :nodoc:
  :"decidim/attributes/clean_string"
end