bridge_cache 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a1803d3bad79ae0bd1b8aee01947fed9f6073e44
4
- data.tar.gz: 13ab7775811a931719dc61ee5affd007e61e4710
3
+ metadata.gz: a62895e07fe22403a7cafb67ecfadd70442215b6
4
+ data.tar.gz: 18b13e6e422ea434da2f56beaebeda253151bef1
5
5
  SHA512:
6
- metadata.gz: 97abf962b0a9b5eb56e4f93b417c1dc6df52ff8521eea270217a6fe6dcb0324bd8807c82ebd66d4d5373d0ddae94ef0cea93b5a06d2bba5caceb4efc655afc37
7
- data.tar.gz: bfc6ad93c70daf3bf557a06d85dca9a2b1077985df7e9b0ce042078f65f553a382d21eae1ce9ebefd942917f7eb05c90707ded51e297e49046e9924f7b315b1c
6
+ metadata.gz: aa1f74aed213baa2ee7291d18d3c83bffee029f47a6e88296dc1e5d868dd3e6a4dc1e7fcfa1f9fa06fc8aabfe6d115e312385de589afde26e47651e9ee39cbe0
7
+ data.tar.gz: c2cc0c9a9fcf13fef15161068cc5bc13d3a21304ff696e76d5d60cd3d66b1b6476f05cd9b097d63333afcd97e151eb285e778879c40ef1ae311cdc0fe3e28e5f
@@ -5,7 +5,7 @@ module BridgeCache
5
5
  before_save :fix_item_type
6
6
 
7
7
  belongs_to :item, polymorphic: true, optional: true
8
- belongs_to :domain, foreign_key: :domain_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::Domain', optional: true
8
+ belongs_to :domain, foreign_key: :domain_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::Domain.name, optional: true
9
9
 
10
10
  private
11
11
 
@@ -2,8 +2,13 @@ module BridgeCache
2
2
  class BridgeBaseModel < ActiveRecord::Base
3
3
  self.abstract_class = true
4
4
 
5
+ BRIDGE_ID = 'bridge_id'.freeze
6
+ OWNER_ID = 'owner_id'.freeze
7
+ PARENT_ID = 'parent_id'.freeze
8
+ DOMAIN_ID = 'domain_id'.freeze
9
+
5
10
  def bridge_id
6
- if self.class.column_names.include? "bridge_id"
11
+ if self.class.column_names.include? BRIDGE_ID
7
12
  self[:bridge_id]
8
13
  else
9
14
  id
@@ -2,14 +2,14 @@ module BridgeCache
2
2
  class CourseTemplate < BridgeBaseModel
3
3
  extend BridgeCache::Data::BridgeModel
4
4
 
5
- belongs_to :user, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::User', optional: true
6
- belongs_to :domain, foreign_key: :domain_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::Domain', optional: true
7
- belongs_to :sub_account, foreign_key: :sub_account_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::Domain', optional: true
8
- has_many :enrollments, foreign_key: :course_template_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::Enrollment'
9
- has_many :group_enrollments, foreign_key: :course_template_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::GroupEnrollment'
10
- has_many :affiliated_sub_accounts, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::AffiliatedSubAccount', as: :item
5
+ belongs_to :user, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::User.name, optional: true
6
+ belongs_to :domain, foreign_key: :domain_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::Domain.name, optional: true
7
+ belongs_to :sub_account, foreign_key: :sub_account_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::Domain.name, optional: true
8
+ has_many :enrollments, foreign_key: :course_template_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::Enrollment.name
9
+ has_many :group_enrollments, foreign_key: :course_template_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::GroupEnrollment.name
10
+ has_many :affiliated_sub_accounts, primary_key: BridgeCache.primary_key, class_name: BridgeCache::AffiliatedSubAccount.name, as: :item
11
11
  has_many :domains, through: :affiliated_sub_accounts
12
- belongs_to :sub_account, foreign_key: :sub_account_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::Domain', optional: true
12
+ belongs_to :sub_account, foreign_key: :sub_account_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::Domain.name, optional: true
13
13
 
14
14
  def self.for_domain(domain_id)
15
15
  includes(:domains)
@@ -2,8 +2,8 @@ module BridgeCache
2
2
  class CustomField < BridgeBaseModel
3
3
  extend BridgeCache::Data::BridgeModel
4
4
 
5
- belongs_to :domain, foreign_key: :domain_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::Domain', optional: true
6
- has_many :learner_custom_field_values, primary_key: BridgeCache.primary_key, foreign_key: :custom_field_id, class_name: 'BridgeCache::LearnerCustomFieldValue'
5
+ belongs_to :domain, foreign_key: :domain_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::Domain.name, optional: true
6
+ has_many :learner_custom_field_values, primary_key: BridgeCache.primary_key, foreign_key: :custom_field_id, class_name: BridgeCache::LearnerCustomFieldValue.name
7
7
 
8
8
  end
9
9
  end
@@ -2,18 +2,18 @@ module BridgeCache
2
2
  class Domain < BridgeBaseModel
3
3
  extend BridgeCache::Data::BridgeModel
4
4
 
5
- has_many :domain_children, primary_key: BridgeCache.primary_key, foreign_key: 'parent_id', class_name: 'BridgeCache::Domain'
6
- belongs_to :domain_parent, primary_key: BridgeCache.primary_key, foreign_key: 'parent_id', class_name: 'BridgeCache::Domain', optional: true
5
+ has_many :domain_children, primary_key: BridgeCache.primary_key, foreign_key: PARENT_ID, class_name: BridgeCache::Domain.name
6
+ belongs_to :domain_parent, primary_key: BridgeCache.primary_key, foreign_key: PARENT_ID, class_name: BridgeCache::Domain.name, optional: true
7
7
 
8
- has_many :domain_ownees, primary_key: BridgeCache.primary_key, foreign_key: 'owner_id', class_name: 'BridgeCache::Domain'
9
- belongs_to :domain_owner, primary_key: BridgeCache.primary_key, foreign_key: 'owner_id', class_name: 'BridgeCache::Domain', optional: true
8
+ has_many :domain_ownees, primary_key: BridgeCache.primary_key, foreign_key: OWNER_ID, class_name: BridgeCache::Domain.name
9
+ belongs_to :domain_owner, primary_key: BridgeCache.primary_key, foreign_key: OWNER_ID, class_name: BridgeCache::Domain.name, optional: true
10
10
 
11
- has_many :programs, primary_key: BridgeCache.primary_key, foreign_key: 'domain_id', class_name: 'BridgeCache::Program'
12
- has_many :course_templates, primary_key: BridgeCache.primary_key, foreign_key: 'domain_id', class_name: 'BridgeCache::CourseTemplate'
13
- has_many :custom_fields, primary_key: BridgeCache.primary_key, foreign_key: 'domain_id', class_name: 'BridgeCache::CustomField'
14
- has_many :grants, primary_key: BridgeCache.primary_key, foreign_key: 'domain_id', class_name: 'BridgeCache::Grant'
11
+ has_many :programs, primary_key: BridgeCache.primary_key, foreign_key: DOMAIN_ID, class_name: BridgeCache::Program.name
12
+ has_many :course_templates, primary_key: BridgeCache.primary_key, foreign_key: DOMAIN_ID, class_name: BridgeCache::CourseTemplate.name
13
+ has_many :custom_fields, primary_key: BridgeCache.primary_key, foreign_key: DOMAIN_ID, class_name: BridgeCache::CustomField.name
14
+ has_many :grants, primary_key: BridgeCache.primary_key, foreign_key: DOMAIN_ID, class_name: BridgeCache::Grant.name
15
15
 
16
- belongs_to :owner, class_name: "BridgeCache::User"
16
+ belongs_to :owner, class_name: BridgeCache::User.name
17
17
 
18
18
  serialize :config
19
19
 
@@ -6,8 +6,8 @@ module BridgeCache
6
6
  joins(:course_template).merge(BridgeCache::CourseTemplate.for_domain(domain_id))
7
7
  end
8
8
 
9
- belongs_to :user, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::User', optional: true
10
- belongs_to :course_template, foreign_key: :course_template_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::CourseTemplate', optional: true
9
+ belongs_to :user, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::User.name, optional: true
10
+ belongs_to :course_template, foreign_key: :course_template_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::CourseTemplate.name, optional: true
11
11
 
12
12
  end
13
13
  end
@@ -2,8 +2,8 @@ module BridgeCache
2
2
  class Grant < BridgeBaseModel
3
3
  extend BridgeCache::Data::BridgeModel
4
4
 
5
- belongs_to :user, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::User', optional: true
6
- belongs_to :domain, foreign_key: :domain_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::Domain', optional: true
5
+ belongs_to :user, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::User.name, optional: true
6
+ belongs_to :domain, foreign_key: :domain_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::Domain.name, optional: true
7
7
 
8
8
  end
9
9
  end
@@ -4,11 +4,11 @@ module BridgeCache
4
4
 
5
5
  self.inheritance_column = nil
6
6
 
7
- belongs_to :user, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::User', optional: true
8
- has_many :program_group_enrollments, foreign_key: :group_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::ProgramGroupEnrollment'
9
- has_many :group_enrollments, foreign_key: :group_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::GroupEnrollment'
10
- has_many :memberships, foreign_key: :group_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::Membership'
11
- belongs_to :domain, foreign_key: :domain_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::Domain', optional: true
7
+ belongs_to :user, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::User.name, optional: true
8
+ has_many :program_group_enrollments, foreign_key: :group_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::ProgramGroupEnrollment.name
9
+ has_many :group_enrollments, foreign_key: :group_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::GroupEnrollment.name
10
+ has_many :memberships, foreign_key: :group_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::Membership.name
11
+ belongs_to :domain, foreign_key: :domain_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::Domain.name, optional: true
12
12
 
13
13
  end
14
14
  end
@@ -6,8 +6,8 @@ module BridgeCache
6
6
  joins(:course_template).where(bridge_cache_course_templates: {domain_id: domain_id})
7
7
  end
8
8
 
9
- belongs_to :group, foreign_key: :group_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::Group', optional: true
10
- belongs_to :course_template, foreign_key: :course_template_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::CourseTemplate', optional: true
9
+ belongs_to :group, foreign_key: :group_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::Group.name, optional: true
10
+ belongs_to :course_template, foreign_key: :course_template_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::CourseTemplate.name, optional: true
11
11
 
12
12
  end
13
13
  end
@@ -6,8 +6,8 @@ module BridgeCache
6
6
  joins(:user).where(bridge_cache_users: {domain_id: domain_id})
7
7
  end
8
8
 
9
- belongs_to :user, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::User', optional: true
10
- belongs_to :custom_field, foreign_key: :custom_field_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::CustomField', optional: true
9
+ belongs_to :user, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::User.name, optional: true
10
+ belongs_to :custom_field, foreign_key: :custom_field_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::CustomField.name, optional: true
11
11
 
12
12
  end
13
13
  end
@@ -2,11 +2,11 @@ module BridgeCache
2
2
  class LiveCourse < BridgeBaseModel
3
3
  extend BridgeCache::Data::BridgeModel
4
4
 
5
- belongs_to :user, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::User', optional: true
6
- belongs_to :domain, foreign_key: :domain_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::Domain', optional: true
7
- belongs_to :sub_account, foreign_key: :sub_account_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::Domain', optional: true
8
- has_many :live_course_enrollments, foreign_key: :live_course_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::LiveCourseEnrollment'
9
- has_many :affiliated_sub_accounts, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::AffiliatedSubAccount', as: :item
5
+ belongs_to :user, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::User.name, optional: true
6
+ belongs_to :domain, foreign_key: :domain_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::Domain.name, optional: true
7
+ belongs_to :sub_account, foreign_key: :sub_account_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::Domain.name, optional: true
8
+ has_many :live_course_enrollments, foreign_key: :live_course_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::LiveCourseEnrollment.name
9
+ has_many :affiliated_sub_accounts, primary_key: BridgeCache.primary_key, class_name: BridgeCache::AffiliatedSubAccount.name, as: :item
10
10
  has_many :domains, through: :affiliated_sub_accounts
11
11
 
12
12
  def self.for_domain(domain_id)
@@ -6,9 +6,9 @@ module BridgeCache
6
6
  joins(:live_course).merge(BridgeCache::LiveCourse.for_domain(domain_id))
7
7
  end
8
8
 
9
- belongs_to :user, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::User', optional: true
10
- belongs_to :live_course, foreign_key: :live_course_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::LiveCourse', optional: true
11
- has_many :live_course_session_registrations, foreign_key: :live_course_enrollment_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::LiveCourseSessionRegistration'
9
+ belongs_to :user, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::User.name, optional: true
10
+ belongs_to :live_course, foreign_key: :live_course_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::LiveCourse.name, optional: true
11
+ has_many :live_course_session_registrations, foreign_key: :live_course_enrollment_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::LiveCourseSessionRegistration.name
12
12
 
13
13
  end
14
14
  end
@@ -6,10 +6,10 @@ module BridgeCache
6
6
  joins(:live_course).merge(BridgeCache::LiveCourse.for_domain(domain_id))
7
7
  end
8
8
 
9
- belongs_to :domain, foreign_key: :domain_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::Domain', optional: true
10
- belongs_to :sub_account, foreign_key: :sub_account_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::Domain', optional: true
11
- belongs_to :live_course, foreign_key: :live_course_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::LiveCourse', optional: true
12
- has_many :live_course_session_registrations, foreign_key: :live_course_session_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::LiveCourseSessionRegistration'
9
+ belongs_to :domain, foreign_key: :domain_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::Domain.name, optional: true
10
+ belongs_to :sub_account, foreign_key: :sub_account_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::Domain.name, optional: true
11
+ belongs_to :live_course, foreign_key: :live_course_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::LiveCourse.name, optional: true
12
+ has_many :live_course_session_registrations, foreign_key: :live_course_session_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::LiveCourseSessionRegistration.name
13
13
 
14
14
  end
15
15
  end
@@ -6,10 +6,10 @@ module BridgeCache
6
6
  joins(:live_course_enrollment).merge(BridgeCache::LiveCourseEnrollment.for_domain(domain_id))
7
7
  end
8
8
 
9
- belongs_to :user, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::User', optional: true
10
- belongs_to :domain, foreign_key: :domain_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::Domain', optional: true
11
- belongs_to :live_course_enrollment, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::LiveCourseEnrollment', optional: true
12
- belongs_to :live_course_session, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::LiveCourseSession', optional: true
9
+ belongs_to :user, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::User.name, optional: true
10
+ belongs_to :domain, foreign_key: :domain_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::Domain.name, optional: true
11
+ belongs_to :live_course_enrollment, primary_key: BridgeCache.primary_key, class_name: BridgeCache::LiveCourseEnrollment.name, optional: true
12
+ belongs_to :live_course_session, primary_key: BridgeCache.primary_key, class_name: BridgeCache::LiveCourseSession.name, optional: true
13
13
 
14
14
  end
15
15
  end
@@ -2,8 +2,8 @@ module BridgeCache
2
2
  class Membership < ApplicationRecord
3
3
  extend BridgeCache::Data::BridgeModel
4
4
 
5
- belongs_to :group, foreign_key: :group_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::Group', optional: true
6
- belongs_to :user, foreign_key: :group_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::User', optional: true
5
+ belongs_to :group, foreign_key: :group_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::Group.name, optional: true
6
+ belongs_to :user, foreign_key: :group_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::User.name, optional: true
7
7
 
8
8
  def self.for_domain(domain_id)
9
9
  joins(:group).where(bridge_cache_groups: {domain_id: domain_id})
@@ -2,12 +2,12 @@ module BridgeCache
2
2
  class Program < BridgeBaseModel
3
3
  extend BridgeCache::Data::BridgeModel
4
4
 
5
- belongs_to :domain, foreign_key: :domain_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::Domain', optional: true
6
- belongs_to :sub_account, foreign_key: :sub_account_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::Domain', optional: true
7
- has_many :program_items, foreign_key: :program_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::ProgramItem'
8
- has_many :program_enrollments, foreign_key: :program_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::ProgramEnrollment'
9
- has_many :program_group_enrollments, foreign_key: :program_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::ProgramGroupEnrollment'
10
- has_many :affiliated_sub_accounts, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::AffiliatedSubAccount', as: :item
5
+ belongs_to :domain, foreign_key: :domain_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::Domain.name, optional: true
6
+ belongs_to :sub_account, foreign_key: :sub_account_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::Domain.name, optional: true
7
+ has_many :program_items, foreign_key: :program_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::ProgramItem.name
8
+ has_many :program_enrollments, foreign_key: :program_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::ProgramEnrollment.name
9
+ has_many :program_group_enrollments, foreign_key: :program_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::ProgramGroupEnrollment.name
10
+ has_many :affiliated_sub_accounts, primary_key: BridgeCache.primary_key, class_name: BridgeCache::AffiliatedSubAccount.name, as: :item
11
11
  has_many :domains, through: :affiliated_sub_accounts
12
12
 
13
13
  def self.for_domain(domain_id)
@@ -2,8 +2,8 @@ module BridgeCache
2
2
  class ProgramEnrollment < BridgeBaseModel
3
3
  extend BridgeCache::Data::BridgeModel
4
4
 
5
- belongs_to :user, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::User', optional: true
6
- belongs_to :program, foreign_key: :program_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::Program', optional: true
5
+ belongs_to :user, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::User.name, optional: true
6
+ belongs_to :program, foreign_key: :program_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::Program.name, optional: true
7
7
 
8
8
  def self.for_domain(domain_id)
9
9
  joins(:program).merge(BridgeCache::Program.for_domain(domain_id))
@@ -2,8 +2,8 @@ module BridgeCache
2
2
  class ProgramGroupEnrollment < BridgeBaseModel
3
3
  extend BridgeCache::Data::BridgeModel
4
4
 
5
- belongs_to :group, foreign_key: :group_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::Group', optional: true
6
- belongs_to :program, foreign_key: :program_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::Program', optional: true
5
+ belongs_to :group, foreign_key: :group_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::Group.name, optional: true
6
+ belongs_to :program, foreign_key: :program_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::Program.name, optional: true
7
7
 
8
8
  end
9
9
  end
@@ -2,7 +2,7 @@ module BridgeCache
2
2
  class ProgramItem < BridgeBaseModel
3
3
  extend BridgeCache::Data::BridgeModel
4
4
 
5
- belongs_to :program, foreign_key: :program_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::Program', optional: true
5
+ belongs_to :program, foreign_key: :program_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::Program.name, optional: true
6
6
 
7
7
  def self.for_domain(domain_id)
8
8
  joins(:program).merge(BridgeCache::Program.for_domain(domain_id))
@@ -2,7 +2,7 @@ module BridgeCache
2
2
  class Tag < BridgeBaseModel
3
3
  extend BridgeCache::Data::BridgeModel
4
4
 
5
- has_many :taggings, foreign_key: :tag_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::Tagging'
5
+ has_many :taggings, foreign_key: :tag_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::Tagging.name
6
6
 
7
7
  end
8
8
  end
@@ -2,8 +2,8 @@ module BridgeCache
2
2
  class Tagging < BridgeBaseModel
3
3
  extend BridgeCache::Data::BridgeModel
4
4
 
5
- belongs_to :tag, foreign_key: :tag_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::Tag', optional: true
6
- belongs_to :user, foreign_key: :tagger_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::User', optional: true
5
+ belongs_to :tag, foreign_key: :tag_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::Tag.name, optional: true
6
+ belongs_to :user, foreign_key: :tagger_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::User.name, optional: true
7
7
 
8
8
  def self.cleanup(current_row_ids)
9
9
  BridgeCache::Tagging.where.not(bridge_id: current_row_ids).destroy_all
@@ -2,18 +2,18 @@ module BridgeCache
2
2
  class User < BridgeBaseModel
3
3
  extend BridgeCache::Data::BridgeModel
4
4
 
5
- belongs_to :domain, foreign_key: :domain_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::Domain', optional: true
6
- belongs_to :sub_account, foreign_key: :sub_account_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::Domain', optional: true
7
- has_many :enrollments, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::Enrollment'
8
- has_many :course_templates, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::CourseTemplate'
9
- has_many :taggings, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::Tagging'
10
- has_many :grants, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::Grant'
11
- has_many :groups, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::Group'
12
- has_many :program_enrollments, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::ProgramEnrollment'
13
- has_many :memberships, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::Membership'
14
- has_many :learner_custom_field_values, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::LearnerCustomFieldValue'
15
- has_many :live_course_enrollments, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::LiveCourseEnrollment'
16
- has_many :live_course_session_registrations, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: 'BridgeCache::LiveCourseSessionRegistration'
5
+ belongs_to :domain, foreign_key: :domain_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::Domain.name, optional: true
6
+ belongs_to :sub_account, foreign_key: :sub_account_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::Domain.name, optional: true
7
+ has_many :enrollments, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::Enrollment.name
8
+ has_many :course_templates, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::CourseTemplate.name
9
+ has_many :taggings, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::Tagging.name
10
+ has_many :grants, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::Grant.name
11
+ has_many :groups, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::Group.name
12
+ has_many :program_enrollments, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::ProgramEnrollment.name
13
+ has_many :memberships, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::Membership.name
14
+ has_many :learner_custom_field_values, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::LearnerCustomFieldValue.name
15
+ has_many :live_course_enrollments, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::LiveCourseEnrollment.name
16
+ has_many :live_course_session_registrations, foreign_key: :user_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::LiveCourseSessionRegistration.name
17
17
 
18
18
  serialize :config
19
19
 
@@ -1,3 +1,3 @@
1
1
  module BridgeCache
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bridge_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - jshaffer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-30 00:00:00.000000000 Z
11
+ date: 2018-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -279,4 +279,3 @@ signing_key:
279
279
  specification_version: 4
280
280
  summary: A mountable engine for bridge data storage
281
281
  test_files: []
282
- has_rdoc: