Sha256: 4158c969540d2dbe03ab7e75058f476039f058f65ea99b108b5bb26f2a6c27d6

Contents?: true

Size: 891 Bytes

Versions: 1

Compression:

Stored size: 891 Bytes

Contents

class UseRestriction < ApplicationRecord
  include MasterModel
  validates :name, presence: true, format: { with: /\A[0-9A-Za-z][0-9A-Za-z_\-\s,]*[0-9a-z]\Z/ }

  scope :available, -> {where(name: ['Not For Loan', 'Limited Circulation, Normal Loan Period'])}
  has_many :item_has_use_restrictions
  has_many :items, through: :item_has_use_restrictions
  translates :display_name

  private

  def valid_name?
    true
  end
end

# == Schema Information
#
# Table name: use_restrictions
#
#  id                        :bigint           not null, primary key
#  name                      :string           not null
#  display_name              :text
#  note                      :text
#  position                  :integer
#  created_at                :datetime         not null
#  updated_at                :datetime         not null
#  display_name_translations :jsonb            not null
#

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
enju_circulation-0.4.0.rc.1 app/models/use_restriction.rb