In my model I have the following setup. It is correctly validating these attributes however the validations do not show up when using simple_form.
class Node < ActiveRecord::Base
store :system_settings, accessors: [:attr_1, :attr_2, :attr_3], coder: HashWithIndifferentAccess
validates :attr_1, presence: true
validates :attr_2, presence: true
validates :attr_3, presence: true
end
And my form is setup like this
= simple_form_for @node, html: {class: 'form-horizontal system-settings-form', multipart: true}, remote: true do |f|
= f.error_notification
= f.simple_fields_for :system_settings do |s|
= s.input :attr_1, input_html: {value: f.object.system_settings[:attr_1]}
= s.input :attr_2, input_html: {value: f.object.system_settings[:attr_2]}
= s.input :attr_3, input_html: {value: f.object.system_settings[:attr_3]}
I am probably not using the form correctly because I am having to force the values instead of simple_form doing its magic (I wouldn't to have mind a better way of doing this). Can someone please help me setup this form to receive the validation errors for these fields?