Sha256: 70ee54b6f479975e922a9475aae9fd640a1c02d7bb4c91c2875c1782a1c211d0

Contents?: true

Size: 246 Bytes

Versions: 29

Compression:

Stored size: 246 Bytes

Contents

# frozen_string_literal: true
class Trophy < ActiveRecord::Base
  validate :count_within_limit, on: :create

  def count_within_limit
    return if Trophy.where(user_id: user_id).count < 5
    errors.add(:base, "Exceeded trophy limit")
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
hyrax-5.1.0.pre.beta1 app/models/trophy.rb
hyrax-5.0.4 app/models/trophy.rb
hyrax-5.0.3 app/models/trophy.rb
hyrax-5.0.2 app/models/trophy.rb
hyrax-5.0.1 app/models/trophy.rb
hyrax-5.0.0 app/models/trophy.rb
hyrax-5.0.0.rc3 app/models/trophy.rb
hyrax-5.0.0.rc2 app/models/trophy.rb
hyrax-5.0.0.rc1 app/models/trophy.rb
hyrax-3.6.0 app/models/trophy.rb
hyrax-4.0.0 app/models/trophy.rb
hyrax-4.0.0.rc3 app/models/trophy.rb
hyrax-4.0.0.rc2 app/models/trophy.rb
hyrax-4.0.0.rc1 app/models/trophy.rb
hyrax-3.5.0 app/models/trophy.rb
hyrax-4.0.0.beta2 app/models/trophy.rb
hyrax-3.4.2 app/models/trophy.rb
hyrax-4.0.0.beta1 app/models/trophy.rb
hyrax-3.4.1 app/models/trophy.rb
hyrax-3.4.0 app/models/trophy.rb