Sha256: 633ce86a9dfa11cafcdcf11a5be1e61b718b3600d33e3508da9b03d0e80b7c7c

Contents?: true

Size: 684 Bytes

Versions: 6

Compression:

Stored size: 684 Bytes

Contents

class UseRestriction < ActiveRecord::Base
  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

  private

  def valid_name?
    true
  end
end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
enju_circulation-0.3.3 app/models/use_restriction.rb
enju_circulation-0.3.2 app/models/use_restriction.rb
enju_circulation-0.3.1 app/models/use_restriction.rb
enju_circulation-0.3.0 app/models/use_restriction.rb
enju_circulation-0.3.0.rc.1 app/models/use_restriction.rb
enju_circulation-0.3.0.beta.1 app/models/use_restriction.rb