Sha256: b8676213457809a6c371e91d96af2ea89765b0d1a887842ca403e9c1a92c0ac4
Contents?: true
Size: 708 Bytes
Versions: 42
Compression:
Stored size: 708 Bytes
Contents
<%= autogenerated_model_warning %> class Role < ApplicationRecord validates :canvas_role_id, uniqueness: true, presence: true has_many :admins, foreign_key: :canvas_role_id, primary_key: :canvas_role_id def self.create_or_update(role_params) role = Role.find_or_initialize_by(canvas_role_id: role_params['id']) role.assign_attributes(label: role_params['label'], base_role_type: role_params['base_role_type'], account: role_params['account'], permissions: role_params['permissions'], workflow_state: role_params['workflow_state']) role.save! if role.changed? role end end
Version data entries
42 entries across 42 versions & 1 rubygems