Sha256: 8abf655113f8448e773e12b96701ccaefccbd13115deecd01f0e81c39391f84e

Contents?: true

Size: 889 Bytes

Versions: 8

Compression:

Stored size: 889 Bytes

Contents

# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
#
# Fat Free CRM is freely distributable under the terms of MIT license.
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
# == Schema Information
#
# Table name: permissions
#
#  id         :integer         not null, primary key
#  user_id    :integer
#  asset_id   :integer
#  asset_type :string(255)
#  created_at :datetime
#  updated_at :datetime
#

class Permission < ActiveRecord::Base
  belongs_to :user
  belongs_to :group
  belongs_to :asset, polymorphic: true

  validates_presence_of :user_id, unless: :group_id?
  validates_presence_of :group_id, unless: :user_id?

  validates_uniqueness_of :user_id, scope: %i[group_id asset_id asset_type]

  ActiveSupport.run_load_hooks(:fat_free_crm_permission, self)
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fat_free_crm-0.15.2 app/models/users/permission.rb
fat_free_crm-0.16.4 app/models/users/permission.rb
fat_free_crm-0.15.1 app/models/users/permission.rb
fat_free_crm-0.16.3 app/models/users/permission.rb
fat_free_crm-0.16.2 app/models/users/permission.rb
fat_free_crm-0.16.1 app/models/users/permission.rb
fat_free_crm-0.16.0 app/models/users/permission.rb
fat_free_crm-0.15.0 app/models/users/permission.rb