mattpolito (owner)

Revisions

gist: 119395 Download_button fork
public
Public Clone URL: git://gist.github.com/119395.git
Embed All Files: show embed
Ruby #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
  validate :uniqueness_of_login_by_store_front, :unless => :skip_uniqueness_of_login_by_store_front?
  validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i
  attr_accessor :password_confirmation
  attr_accessor :validate_password
   
  has_many :store_front_users, :include => :roles
  has_many :store_fronts, :through => :store_front_users
  belongs_to :language_type
  
  # Logic
  class << self
    def find_by_login_in_store_front(login)
      UserInfo.current_store_front.users.find_by_login(login)
    end
  end
  
  def is_valid?
    self.validate_password = false
    @skip_uniqueness_of_login_by_store_front = true
    return_val = self.valid?
    @skip_uniqueness_of_login_by_store_front = false
    return_val
  end
  
  def skip_uniqueness_of_login_by_store_front?
    @skip_uniqueness_of_login_by_store_front
  end