jendiamond / railsgirls-signup

https://railsgirls-signup.herokuapp.com
3 stars 3 forks source link

User & Coach sign up forms don't reject wrong submissions #48

Open jendiamond opened 8 years ago

jendiamond commented 8 years ago

Pull Request #81

The users/new and the coach/new sign up forms don't reject wrong submissions.


Add validations

app/models/coaches.rb

class Coach < ApplicationRecord
  validates :first_name, presence: true
  validates :first_name, length: { minimum: 2 }
  validates :first_name, length: { minimum: 30 }
  validates :last_name, presence: true
  validates :last_name, length: { minimum: 2 }
  validates :last_name, length: { minimum: 30 }
  validates :email, presence: true
  validates :days, presence: true
  validates :operating_system, presence: true
end

http://guides.rubyonrails.org/active_record_validations.html
http://stackoverflow.com/questions/16725010/rails-simple-form-validation