Sha256: 7f36dfd6523ec8e6e9665a2fd1e42d6784d7d5c8d61598f6c71daea9dea3c150

Contents?: true

Size: 836 Bytes

Versions: 7

Compression:

Stored size: 836 Bytes

Contents

# EffectiveCpdUser
#
# Mark your user model with effective_cpd_user to get a few helpers
# And user specific point required scores

module EffectiveCpdUser
  extend ActiveSupport::Concern

  module Base
    def effective_cpd_user
      include ::EffectiveCpdUser
    end
  end

  included do
    has_many :cpd_statements, -> { Effective::CpdStatement.sorted }, class_name: 'Effective::CpdStatement'
    has_many :cpd_audits, -> { Effective::CpdAudit.sorted }, inverse_of: :user, class_name: 'Effective::CpdAudit'
    has_many :cpd_audit_reviews, -> { Effective::CpdAuditReview.sorted }, inverse_of: :user, class_name: 'Effective::CpdAuditReview'
  end

  def cpd_statement_required_score(cpd_statement)
    nil
  end

  def cpd_audit_cpd_required?
    true
  end

  module ClassMethods
    def effective_cpd_user?; true; end
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
effective_cpd-0.4.1 app/models/concerns/effective_cpd_user.rb
effective_cpd-0.4.0 app/models/concerns/effective_cpd_user.rb
effective_cpd-0.3.3 app/models/concerns/effective_cpd_user.rb
effective_cpd-0.3.2 app/models/concerns/effective_cpd_user.rb
effective_cpd-0.3.1 app/models/concerns/effective_cpd_user.rb
effective_cpd-0.3.0 app/models/concerns/effective_cpd_user.rb
effective_cpd-0.2.1 app/models/concerns/effective_cpd_user.rb