diff --git a/app/models/hps_member.rb b/app/models/hps_member.rb index ea35480..1d2d3b4 100644 --- a/app/models/hps_member.rb +++ b/app/models/hps_member.rb @@ -34,7 +34,7 @@ class HpsMember has_secure_password validates :account, uniqueness: true - validates :password, :on => [:create], length: {:in => 8..20} + validates :password, :on => [:create] has_many :hps_files, :dependent => :destroy diff --git a/lib/tasks/hps_task.rake b/lib/tasks/hps_task.rake index 4b2d6f3..a2b0baa 100644 --- a/lib/tasks/hps_task.rake +++ b/lib/tasks/hps_task.rake @@ -56,9 +56,10 @@ namespace :hps_task do users = JSON.parse(data) users.each do |user| hpsm = HpsMember.where(:old_id => user["old_id"]).first rescue nil - if !hpsm.nil? + if hpsm.nil? hpsm = HpsMember.new end + puts "Createing acccount #{user["account"]}" hpsm.old_id = user["old_id"] hpsm.account = user["account"] hpsm.password = user["password"] @@ -69,11 +70,11 @@ namespace :hps_task do hpsm.address = user["address"] hpsm.title = user["title"] school = HpsSchool.where(:old_id => user["SchoolID"]).first - hpsm.hps_school_id = school.id.to_s + hpsm.hps_school_id = school.id.to_s if !school.nil? city = HpsCity.where(:old_id => user["my_county"]).first - hpsm.hps_city_id = city.id.to_s + hpsm.hps_city_id = city.id.to_s if !city.nil? county = HpsCounty.where(:old_id => user["cityzip"]).first - hpsm.hps_county_id = county.id.to_s + hpsm.hps_county_id = county.id.to_s if !county.nil? hpsm.save end end