Sha256: c86393d7c2046bbab7a2bb0c599a7cf30d5e8c19e493bb227e5a3c293a7d6cb7

Contents?: true

Size: 216 Bytes

Versions: 80

Compression:

Stored size: 216 Bytes

Contents

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

80 entries across 80 versions & 4 rubygems

Version Path
hyrax-2.9.6 app/models/trophy.rb
hyrax-2.9.5 app/models/trophy.rb
hyrax-2.9.4 app/models/trophy.rb
hyrax-2.9.3 app/models/trophy.rb
hyrax-2.9.2 app/models/trophy.rb
hyrax-2.9.1 app/models/trophy.rb
hyrax-2.9.0 app/models/trophy.rb
hyrax-2.8.0 app/models/trophy.rb
hyrax-2.7.2 app/models/trophy.rb
hyrax-2.7.1 app/models/trophy.rb
hyrax-2.7.0 app/models/trophy.rb
hyrax-2.6.0 app/models/trophy.rb
hyrax-3.0.0.pre.rc1 app/models/trophy.rb
hyrax-3.0.0.pre.beta3 app/models/trophy.rb
hyrax-2.5.1 app/models/trophy.rb
hyrax-2.5.0 app/models/trophy.rb
hyrax-3.0.0.pre.beta2 app/models/trophy.rb
hyrax-2.4.1 app/models/trophy.rb
hyrax-3.0.0.pre.beta1 app/models/trophy.rb
hyrax-2.4.0 app/models/trophy.rb