Fix signed in employee adding supplier functionality
This commit is contained in:
@@ -15,7 +15,7 @@ class Employee
|
||||
end
|
||||
end
|
||||
|
||||
view :by_confirmation_token, key: :confirmation_token # devise confirmable
|
||||
#view :by_confirmation_token, key: :confirmation_token # devise confirmable
|
||||
devise :database_authenticatable, :recoverable, :rememberable, :trackable #, :registerable #, :confirmable
|
||||
property :unconfirmed_email
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ class NewSupplier
|
||||
private
|
||||
|
||||
def persist!
|
||||
@employee ||= current_employee
|
||||
@employee ||= Employee.new email: email, password: password, password_confirmation: password_confirmation
|
||||
raise "Cannot create employee with #{attributes.inspect}" unless employee.save
|
||||
@supplier = Supplier.create name: supplier_name
|
||||
@@ -36,6 +37,7 @@ class NewSupplier
|
||||
|
||||
def employee_uniqueness_or_existence
|
||||
return if current_employee.present?
|
||||
return if @employee = current_employee
|
||||
if Employee.count_by_email(email) > 0
|
||||
employee = Employee.find_by_email(email)
|
||||
if employee.valid_password? password
|
||||
|
||||
Reference in New Issue
Block a user