Sha256: 9653b3f11b36333ac399012418f1fd33c961c4217089a5d513d152cbc5540ce9

Contents?: true

Size: 871 Bytes

Versions: 5

Compression:

Stored size: 871 Bytes

Contents

class LendingPolicy < ApplicationRecord
  default_scope { order('lending_policies.position') }
  belongs_to :item
  belongs_to :user_group

  validates :item, :user_group, presence: true
  validates :user_group_id, uniqueness: { scope: :item_id }
  validates_date :fixed_due_date, allow_blank: true

  paginates_per 10

  acts_as_list scope: :item_id
end

# == Schema Information
#
# Table name: lending_policies
#
#  id             :integer          not null, primary key
#  item_id        :integer          not null
#  user_group_id  :integer          not null
#  loan_period    :integer          default(0), not null
#  fixed_due_date :datetime
#  renewal        :integer          default(0), not null
#  fine           :integer          default(0), not null
#  note           :text
#  position       :integer
#  created_at     :datetime
#  updated_at     :datetime
#

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
enju_circulation-0.3.8 app/models/lending_policy.rb
enju_circulation-0.3.7 app/models/lending_policy.rb
enju_circulation-0.3.6 app/models/lending_policy.rb
enju_circulation-0.3.5 app/models/lending_policy.rb
enju_circulation-0.3.4 app/models/lending_policy.rb