Module: Jwtauth::Model::ClassMethods

Defined in:
lib/jwtauth.rb

Instance Method Summary collapse

Instance Method Details

#new2nd(params, current_user) ⇒ Object



254
255
256
257
258
259
260
261
262
# File 'lib/jwtauth.rb', line 254

def new2nd params, current_user
  _record = self.new(params)

  _record[self::ForeignKeys::USER_ID] = current_user.id if _record[self::ForeignKeys::USER_ID].blank?
  _record[self::ForeignKeys::DEPARTMENT_ID] = current_user.department_id if _record[self::ForeignKeys::DEPARTMENT_ID].blank?
  _record[self::ForeignKeys::COMPANY_ID] = current_user.company_id if _record[self::ForeignKeys::COMPANY_ID].blank?

  _record
end