Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make hfc_number attr_readonly

  • Loading branch information...
commit 9a603ef0cf92318508f76c119e69a973f7c9b419 1 parent f8dc2b4
@pbm authored
Showing with 2 additions and 22 deletions.
  1. +2 −22 app/models/user.rb
View
24 app/models/user.rb
@@ -13,8 +13,9 @@ class User < ActiveRecord::Base
attr_accessible :first_name, :last_name, :email, :avatar, :is_public, :password
attr_accessible :first_name, :last_name, :email, :avatar, :is_public, :password,
- :hfc_number, :membership_id, :roles_mask,
+ :membership_id, :roles_mask,
:as => :admin
+ attr_readonly :hfc_number
belongs_to :membership
validates_presence_of :membership
@@ -72,27 +73,6 @@ def name
"#{first_name} #{last_name}"
end
- def self.read_club_members(csv_file)
- #puts "#{self}.read_club_members"
- level_2_m = Membership.by_level
- CSV.foreach(csv_file) do |row|
- next if row[0] == "Acct #"
-
- hfc_number, ln, fn, level = row
- hfc_number = Integer(hfc_number)
- level = Integer(level)
-
- u = User.create(:email => "#{fn}.#{ln}@hfc.org",
- :password => fn,
- :password_confirmation => fn,
- :first_name => fn,
- :last_name => ln,
- :hfc_number => hfc_number,
- :membership => level_2_m[level])
- u.save!
- end
- end
-
# returns a hash of hfc_number => User
def self.by_hfc_number
User.all.inject({ }) { |h,u| h[u.hfc_number] = u if u.hfc_number; h }
Please sign in to comment.
Something went wrong with that request. Please try again.