0

In my Ruby on Rails application i've set up a user registration / login system that have some validations in the class ( for register a User).

 class User < ActiveRecord::Base
  # Put the email downcase before save the User
  before_save {self.email = email.downcase}

  # Confirmation of the password before save
  validates_confirmation_of :password
  has_secure_password

  validates :first_name, :last_name,
            presence: true,
            format:{ without: /\s/ }

  validates :email, uniqueness: true,
            format:{
                with: /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
            }
  def to_s
    "#{first_name} #{last_name}"
  end

end

In this application i also use AngularJS and the question is, can i use AngularJS for the live validation of the user during the registration?

1 Answer 1

1

If you want to validate live your fields you'll have to use AngularJS validators. Those ruby validators will be called when you'll submit the form.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.