small fix, removed before_create call back and added it to form

This commit is contained in:
Harry Bomrah 2018-09-10 23:39:32 +08:00
parent f72fc5bd9f
commit 069adb6c7b
3 changed files with 3 additions and 10 deletions

View File

@ -428,6 +428,7 @@ class RecruitmentsController < PseudoSessionController
def createprofile
profile = RecruitProfile.create(profile_params)
# debugger
if profile.is_employer?
redirect_to mydashboard_path
elsif profile.is_employee?

View File

@ -22,15 +22,6 @@ class RecruitProfile
has_one :employer_profile, :autosave => true, :dependent => :destroy
accepts_nested_attributes_for :employer_profile, :allow_destroy => true
before_create :disable_employer
def disable_employer
if self.is_employer?
self.enabled = false
end
end
def disable_user
pu = PseudoUser.where(:user_name => self.pseudo_member_id).first
pu.enabled = false

View File

@ -181,7 +181,8 @@
<%= f.hidden_field :email, :value => current_pseudo_user.email %>
<%= f.hidden_field :first_name, :value => current_pseudo_user.first_name %>
<%= f.hidden_field :last_name, :value => current_pseudo_user.last_name %>
<%= f.hidden_field :user_type, :value => "2" %>
<%= f.hidden_field :user_type, :value => "2" %>
<%= f.hidden_field :enabled, :value => "false" %>
<%= f.submit t("submit"), :class =>"btn btn-primary" %>
</div>
</div>