Sha256: ad57462f24a403e69a508376510eabeda20c8bc6ca3982d1ce696bfe542d06c3

Contents?: true

Size: 352 Bytes

Versions: 2

Compression:

Stored size: 352 Bytes

Contents

# frozen_string_literal: true

ActiveRecord::Base.connection.create_table(:contributions, force: true) do |t|
  t.integer :user_id
  t.text    :data
  t.date    :date
end

class Contribution < ActiveRecord::Base
  second_level_cache

  validates_uniqueness_of :user_id, scope: :date, if: -> { user_id_changed? || date_changed? }
  belongs_to :user
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
second_level_cache-2.6.0 test/model/contribution.rb
second_level_cache-2.5.3 test/model/contribution.rb