Permalink
Browse files

Removed the unique First/Last name restriction for users. I don't thi…

…nk that we can really force unique names.
  • Loading branch information...
1 parent 6fd83f7 commit e86197b2e23bbd84924d5b9518d40172214c1d68 @rnhurt committed Aug 21, 2010
Showing with 5 additions and 9 deletions.
  1. +1 −1 app/controllers/settings/imports_controller.rb
  2. +4 −8 app/models/user.rb
@@ -5,7 +5,7 @@ class Settings::ImportsController < SettingsController
# to re-use the same 'create' action for different types of data.
def create
- @parsed_file=CSV::Reader.parse(params[:import][:file])
+ @parsed_file = CSV::Reader.parse(params[:import][:file])
@import = User.new
@valid_records = 0
@record_counter = 0
View
@@ -11,26 +11,22 @@ class User < ActiveRecord::Base
end
belongs_to :site
-# has_many :comments
+ # has_many :comments
validates_length_of :first_name, :in => 1..20
validates_length_of :last_name, :in => 1..20
validates_existence_of :site
- # Users should be unique, so don't allow a user with the same First & Last Name
- # in the system.
- validates_uniqueness_of :first_name, :scope => :last_name
-
named_scope :active, :conditions => { :active => true }
# Search for a user using the 'will_paginate' plugin
def self.search(params)
search = params[:search]
search.downcase! if search # Make sure we don't have any case sensitivity problems
paginate :per_page => 15, :page => params[:page],
- :conditions => ['LOWER(first_name) like ? or LOWER(last_name) like ?', "%#{search}%", "%#{search}%"],
- :order => params[:sort_clause],
- :include => :site
+ :conditions => ['LOWER(first_name) like ? or LOWER(last_name) like ?', "%#{search}%", "%#{search}%"],
+ :order => params[:sort_clause],
+ :include => :site
end
# Return the valid user types available

0 comments on commit e86197b

Please sign in to comment.