removed mass assignment of user_id in the users model

This commit is contained in:
Ken Johnson
2013-05-31 11:08:38 -04:00
parent 08a8c60276
commit 97ca13632d
3 changed files with 16 additions and 3 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
class User < ActiveRecord::Base class User < ActiveRecord::Base
attr_accessible :email, :password, :user_id, :admin, :password_confirmation, :first_name, :last_name attr_accessible :email, :password, :admin, :password_confirmation, :first_name, :last_name
validates_confirmation_of :password, :password_confirmation, :on => :create validates_confirmation_of :password, :password_confirmation, :on => :create
validates :password, :presence => true, validates :password, :presence => true,
:confirmation => true, :confirmation => true,
+12 -1
View File
@@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20130527165832) do ActiveRecord::Schema.define(:version => 20130531143853) do
create_table "paid_time_offs", :force => true do |t| create_table "paid_time_offs", :force => true do |t|
t.integer "user_id" t.integer "user_id"
@@ -54,4 +54,15 @@ ActiveRecord::Schema.define(:version => 20130527165832) do
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
end end
create_table "work_infos", :force => true do |t|
t.integer "user_id"
t.string "income"
t.string "bonuses"
t.integer "years_worked"
t.string "SSN"
t.date "DoB"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
end end
+3 -1
View File
@@ -146,7 +146,9 @@ paid_time_off = [
users.each do |user_info| users.each do |user_info|
User.create!(user_info) user = User.new(user_info.reject {|k| k == :user_id})
user.user_id = user_info[:user_id]
user.save
end end
retirements.each do |r| retirements.each do |r|