Method: Hash#as_attributes_string
- Defined in:
- lib/active_form/core_extensions.rb
#as_attributes_string ⇒ Object
define these methods for any value holder you want to bind
73 74 75 76 77 78 79 80 81 |
# File 'lib/active_form/core_extensions.rb', line 73 def as_attributes_string attributes = self.delete_blanks.stringify_keys parts = attributes.keys.sort.inject([]) do |attrs, k| v = attributes[k].to_s.to_xs.gsub(%r{"}, '"') attrs << "#{k}=\"#{v}\"" attrs end parts.join(' ') end |