ruby - Using the Rails form_for "req" option -


i trying make ruby tag field required field client side , trying via:

<%= f.text_field :name, :placeholder => 'event title', :id => "form-field-first", :class => "form-field", :class => "req" %> 

but still submits no prob if field empty. more complicated this? have go in .rb file , make special required class? help!

as noted @ http://guides.rubyonrails.org/active_record_validations.html#presence,

you should use validates :field, presence: true in model.rb file this.


Comments