Sha256: b7bf05d30baefe8edb19f854de6add35137fa388f02672d537fec05b21631ad2
Contents?: true
Size: 836 Bytes
Versions: 42
Compression:
Stored size: 836 Bytes
Contents
<%= autogenerated_model_warning %> class Admin < ApplicationRecord validates :canvas_admin_id, uniqueness: true, presence: true belongs_to :user, primary_key: :canvas_user_id, foreign_key: :canvas_user_id, optional: true belongs_to :role, primary_key: :canvas_role_id, foreign_key: :canvas_role_id, optional: true def self.create_or_update(admin_params) admin = Admin.find_or_initialize_by(canvas_admin_id: admin_params['id']) admin.assign_attributes(role_name: admin_params['role'], canvas_role_id: admin_params['role_id'], user_data: admin_params['user'], canvas_user_id: admin_params['user']['id'], workflow_state: admin_params['workflow_state']) admin.save! if admin.changed? admin end end
Version data entries
42 entries across 42 versions & 1 rubygems