mercredi 9 septembre 2015

Ruby on Rails 3 checkbox validations?

- @offering.training.each do |train|
    = check_box_tag "train_ids[#{train.id}]", train.id
    = train.text

Model:

class Training < ActiveRecord::Base
  attr_accessible :text

  belongs_to :offering

 validates :text, presence: true 
end

How do you validate checkboxes in rails 3? The following code doesn't work at the moment. I would appreciate your help guys. Thanks

Aucun commentaire:

Enregistrer un commentaire