Merge pull request #267 from cktricky/switch_build_user_info_from_controller_to_model
Relocated build_benefits_data invocation
This commit is contained in:
@@ -8,7 +8,6 @@ class UsersController < ApplicationController
|
||||
|
||||
def create
|
||||
user = User.new(user_params)
|
||||
user.build_benefits_data
|
||||
if user.save
|
||||
session[:user_id] = user.user_id
|
||||
redirect_to home_dashboard_index_path
|
||||
|
||||
@@ -21,6 +21,7 @@ class User < ApplicationRecord
|
||||
has_many :messages, :foreign_key => :receiver_id, :primary_key => :user_id, :dependent => :destroy
|
||||
has_many :pay, :foreign_key => :user_id, :primary_key => :user_id, :dependent => :destroy
|
||||
before_create { generate_token(:auth_token) }
|
||||
before_create :build_benefits_data
|
||||
|
||||
def build_benefits_data
|
||||
build_retirement(POPULATE_RETIREMENTS.shuffle.first)
|
||||
|
||||
@@ -11,7 +11,6 @@ class UserFixture
|
||||
def user.clear_password
|
||||
'thi$ 1s cOmplExEr'
|
||||
end
|
||||
user.build_benefits_data
|
||||
user.save!
|
||||
user
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user