Sha256: 904dee51dd17bb072617c854ce2174226a5274aa2de677b05894f4d7748fa263

Contents?: true

Size: 818 Bytes

Versions: 10

Compression:

Stored size: 818 Bytes

Contents

require 'action_view/helpers/auto_tag_helper/form_info'
require 'activerecord/mlang'
class OrgDepartmentPosition < ActiveRecord::Base
  belongs_to :org_department
  has_many :member_mappings, class_name: "OrgDepartmentPositionMemberMapping"
  has_many :members, through: :member_mappings, source: :org_member

  include ActiveRecord::Mlang
  include ActionView::Helpers::AutoTagHelper::FormInfo

#  def self.editable_columns(); [] ;  end

  def __display__
    self.text.label
  end

  def add(member)
    member_id = case member
                when OrgMember then member.id
                when Integer   then member
                else                member.to_i
                end
    OrgDepartmentPositionMemberMapping.find_or_create_by(org_department_position_id: self.id, org_member_id: member_id)
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
we_bridge_rails_engine_orgs-0.1.16 app/models/org_department_position.rb
we_bridge_rails_engine_orgs-0.1.15 app/models/org_department_position.rb
we_bridge_rails_engine_orgs-0.1.14 app/models/org_department_position.rb
we_bridge_rails_engine_orgs-0.1.13 app/models/org_department_position.rb
we_bridge_rails_engine_orgs-0.1.12 app/models/org_department_position.rb
we_bridge_rails_engine_orgs-0.1.11 app/models/org_department_position.rb
we_bridge_rails_engine_orgs-0.1.10 app/models/org_department_position.rb
we_bridge_rails_engine_orgs-0.1.9 app/models/org_department_position.rb
we_bridge_rails_engine_orgs-0.1.8 app/models/org_department_position.rb
we_bridge_rails_engine_orgs-0.1.7 app/models/org_department_position.rb