Ken W
Ken W

Reputation: 962

Rails: :case_sensitive => false validation does not take effect on heroku

so I'm trying to make usernames case_insensitive on my rails app and having added :case_sensitive => false to my development code works just fine but when I push to heroku it doesn't make any bit of difference.

What gives?

any ideas?

class User < ActiveRecord::Base

  validates :name, presence: true, :uniqueness => { :case_sensitive => false }
  validates_format_of :email,:with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i

  has_many :feeds, :through => :subscriptions, dependent: :destroy

  has_many :subscriptions

  has_secure_password

Upvotes: 0

Views: 512

Answers (1)

Ken W
Ken W

Reputation: 962

Turns out that since PostgreSQL is inherently case-sensitive, adding the case_insensitive validation to a model has no effect on a Postgresql db backed app

Upvotes: 2

Related Questions