Tim Sutcliffe

  • Archive
  • RSS

Awesome validators

    • #validation
    • #password
  • 3 years ago
  • Permalink
  • Share
    Tweet

validates_confirmation_of

http://apidock.com/rails/ActiveModel/Validations/ClassMethods/validates_confirmation_of

validates_confirmation_of(*attr_names) public

Encapsulates the pattern of wanting to validate a password or email address field with a confirmation. Example:

  Model:
class Person < ActiveRecord::Base
validates_confirmation_of :user_name, :password
validates_confirmation_of :email_address, :message => "should match confirmation"
end

View:
<%= password_field "person", "password" %>
<%= password_field "person", "password_confirmation" %>

The added password_confirmation attribute is virtual; it exists only as an in-memory attribute for validating the password. To achieve this, the validation adds accessors to the model for the confirmation attribute. NOTE: This check is performed only if password_confirmation is not nil, and by default only on save. To require confirmation, make sure to add a presence check for the confirmation attribute:

    • #Password
  • 3 years ago
  • Permalink
  • Share
    Tweet

Goo Authenticatin but without 'confirm password'

    • #password
    • #user authentication
  • 3 years ago
  • Permalink
  • Share
    Tweet

About

Hello,
Hope you enjoy this collection of useful design resources and delightful images.

I'm a User Experience Designer working in San Francisco. I'm currently the design director for Wikia.com.

My weekend and evening project is a rails app called jov.io. We're blogging all the amazing things we have discovered in California and the UK. It's a collaborative project so if you want to join in please grab an account and get posting.

Twitter

loading tweets…

  • RSS
  • Random
  • Archive
  • Mobile

Effector Theme by Carlo Franco.

Powered by Tumblr