i mean in rails, can i build form by reading validation rules.
my user model:
class User < ActiveRecord::Base
validates :name,
:email,
:sex,
presence: true
validates :password, presence: true, length: { minimum: 6 }
end
my views/users/_form is original from scaffold generated.
i want my html source code output like this :
for name, email, sex input fields, i want an attributes data-val='true' data-val-required="this field is required"
for password field, an attribute data-val='true' data-val-required='this field is required' data-val-length-min='6'
anyone can help ?
thanks !