repo
stringlengths
5
92
file_url
stringlengths
80
287
file_path
stringlengths
5
197
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:37:27
2026-01-04 17:58:21
truncated
bool
2 classes
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/import_request.rb
app/models/import_request.rb
class ImportRequest < ApplicationRecord include Statesman::Adapters::ActiveRecordQueries[ transition_class: ImportRequestTransition, initial_state: ImportRequestStateMachine.initial_state ] default_scope { order("import_requests.id DESC") } belongs_to :manifestation, optional: true belongs_to :user ...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/item.rb
app/models/item.rb
class Item < ApplicationRecord scope :available, -> { includes(:circulation_status).where.not("circulation_statuses.name" => "Removed") } scope :removed, -> { includes(:circulation_status).where("circulation_statuses.name" => "Removed") } scope :on_shelf, -> { available.includes(:shelf).references(:shelf).where.n...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/checkout_stat_has_user.rb
app/models/checkout_stat_has_user.rb
class CheckoutStatHasUser < ApplicationRecord belongs_to :user_checkout_stat belongs_to :user validates :user_id, uniqueness: { scope: :user_checkout_stat_id } paginates_per 10 end # == Schema Information # # Table name: checkout_stat_has_users # # id :bigint not null, primary k...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/basket.rb
app/models/basket.rb
class Basket < ApplicationRecord include EnjuCirculation::EnjuBasket default_scope { order("baskets.id DESC") } scope :will_expire, lambda { |date| where("created_at < ?", date) } belongs_to :user, optional: true has_many :accepts, dependent: :destroy has_many :withdraws, dependent: :destroy # 貸出完了後にかごのユ...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/circulation_status.rb
app/models/circulation_status.rb
class CirculationStatus < ApplicationRecord include MasterModel validates :name, presence: true, format: { with: /\A[0-9A-Za-z][0-9A-Za-z_\-\s,]*[0-9a-z]\Z/ } default_scope { order("circulation_statuses.position") } scope :available_for_checkout, -> { where(name: "Available On Shelf") } has_many :items, depe...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/produce.rb
app/models/produce.rb
class Produce < ApplicationRecord belongs_to :agent belongs_to :manifestation, touch: true belongs_to :produce_type, optional: true delegate :original_title, to: :manifestation, prefix: true validates :manifestation_id, uniqueness: { scope: :agent_id } after_destroy :reindex after_save :reindex acts_a...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/message_transition.rb
app/models/message_transition.rb
class MessageTransition < ApplicationRecord belongs_to :message, inverse_of: :message_transitions end # == Schema Information # # Table name: message_transitions # # id :bigint not null, primary key # metadata :jsonb not null # most_recent :boolean not null # sort_key ...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/checkout.rb
app/models/checkout.rb
class Checkout < ApplicationRecord scope :not_returned, -> { where(checkin_id: nil) } scope :returned, -> { where.not(checkin_id: nil) } scope :overdue, lambda { |date| where("checkin_id IS NULL AND due_date < ?", date) } scope :due_date_on, lambda { |date| where(checkin_id: nil, due_date: date.beginning_of_day...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/demand.rb
app/models/demand.rb
class Demand < ApplicationRecord belongs_to :user belongs_to :item belongs_to :message end # == Schema Information # # Table name: demands # # id :bigint not null, primary key # created_at :datetime not null # updated_at :datetime not null # item_id :bigint # message_id ...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/agent_import_file_state_machine.rb
app/models/agent_import_file_state_machine.rb
class AgentImportFileStateMachine include Statesman::Machine state :pending, initial: true state :started state :completed state :failed transition from: :pending, to: [ :started, :failed ] transition from: :started, to: [ :completed, :failed ] after_transition(from: :pending, to: :started) do |agent...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/bookmark_stat_state_machine.rb
app/models/bookmark_stat_state_machine.rb
class BookmarkStatStateMachine include Statesman::Machine state :pending, initial: true state :started state :completed transition from: :pending, to: :started transition from: :started, to: :completed after_transition(to: :started) do |bookmark_stat| bookmark_stat.calculate_count! end end
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/participate.rb
app/models/participate.rb
class Participate < ApplicationRecord belongs_to :agent belongs_to :event validates :agent_id, uniqueness: { scope: :event_id } acts_as_list scope: :event_id paginates_per 10 end # == Schema Information # # Table name: participates # # id :bigint not null, primary key # position :inte...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/manifestation_relationship_type.rb
app/models/manifestation_relationship_type.rb
class ManifestationRelationshipType < ApplicationRecord include MasterModel default_scope { order("manifestation_relationship_types.position") } has_many :manifestation_relationships, dependent: :destroy end # == Schema Information # # Table name: manifestation_relationship_types # # id :bigint ...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/subject_type.rb
app/models/subject_type.rb
class SubjectType < ApplicationRecord include MasterModel has_many :subjects, dependent: :restrict_with_exception validates :name, format: { with: /\A[0-9A-Za-z][0-9a-z_\-]*[0-9a-z]\Z/ } end # == Schema Information # # Table name: subject_types # # id :bigint not null, primary key # display...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/request_type.rb
app/models/request_type.rb
class RequestType < ApplicationRecord include MasterModel validates :name, presence: true, format: { with: /\A[0-9A-Za-z][0-9A-Za-z_\-\s,]*[0-9a-z]\Z/ } private def valid_name? true end end # == Schema Information # # Table name: request_types # # id :bigint not null, primary key #...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/use_restriction.rb
app/models/use_restriction.rb
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, dependent: :destro...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/resource_import_file.rb
app/models/resource_import_file.rb
class ResourceImportFile < ApplicationRecord include Statesman::Adapters::ActiveRecordQueries[ transition_class: ResourceImportFileTransition, initial_state: ResourceImportFileStateMachine.initial_state ] include ImportFile default_scope { order("resource_import_files.id DESC") } scope :not_imported, ...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
true
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/classification.rb
app/models/classification.rb
class Classification < ApplicationRecord belongs_to :classification_type belongs_to :manifestation, touch: true, optional: true validates :category, presence: true searchable do text :category, :note integer :classification_type_id end strip_attributes only: [ :category, :url ] paginates_per 10 ...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/form_of_work.rb
app/models/form_of_work.rb
class FormOfWork < ApplicationRecord include MasterModel has_many :works, class_name: "Manifestation" # , dependent: :restrict_with_exception end # == Schema Information # # Table name: form_of_works # # id :bigint not null, primary key # display_name :text # name :string n...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/resource_export_file_transition.rb
app/models/resource_export_file_transition.rb
class ResourceExportFileTransition < ApplicationRecord belongs_to :resource_export_file, inverse_of: :resource_export_file_transitions end # == Schema Information # # Table name: resource_export_file_transitions # # id :bigint not null, primary key # metadata :jsonb ...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/ndl_bib_id_record.rb
app/models/ndl_bib_id_record.rb
class NdlBibIdRecord < ApplicationRecord belongs_to :manifestation validates :body, presence: true, uniqueness: true end # == Schema Information # # Table name: ndl_bib_id_records # # id :bigint not null, primary key # body :string not null # created_at :datet...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/request_status_type.rb
app/models/request_status_type.rb
class RequestStatusType < ApplicationRecord include MasterModel validates :name, presence: true, format: { with: /\A[0-9A-Za-z][0-9A-Za-z_\-\s,]*[0-9a-z]\Z/ } has_many :reserves, dependent: :restrict_with_exception private def valid_name? true end end # == Schema Information # # Table name: request_s...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/agent_relationship_type.rb
app/models/agent_relationship_type.rb
class AgentRelationshipType < ApplicationRecord include MasterModel default_scope { order("agent_relationship_types.position") } has_many :agent_relationships, dependent: :destroy end # == Schema Information # # Table name: agent_relationship_types # # id :bigint not null, primary key # dis...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/user_reserve_stat.rb
app/models/user_reserve_stat.rb
class UserReserveStat < ApplicationRecord include Statesman::Adapters::ActiveRecordQueries[ transition_class: UserReserveStatTransition, initial_state: UserReserveStatStateMachine.initial_state ] include CalculateStat default_scope { order("user_reserve_stats.id DESC") } scope :not_calculated, -> { in...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/isbn_record_and_manifestation.rb
app/models/isbn_record_and_manifestation.rb
class IsbnRecordAndManifestation < ApplicationRecord belongs_to :isbn_record belongs_to :manifestation validates :isbn_record_id, uniqueness: { scope: :manifestation_id } end # == Schema Information # # Table name: isbn_record_and_manifestations(書誌とISBNの関係) # # id :bigint not null, prima...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/checkout_stat_has_manifestation.rb
app/models/checkout_stat_has_manifestation.rb
class CheckoutStatHasManifestation < ApplicationRecord belongs_to :manifestation_checkout_stat belongs_to :manifestation validates :manifestation_id, uniqueness: { scope: :manifestation_checkout_stat_id } paginates_per 10 end # == Schema Information # # Table name: checkout_stat_has_manifestations # # id ...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/manifestation.rb
app/models/manifestation.rb
class Manifestation < ApplicationRecord include EnjuCirculation::EnjuManifestation include EnjuSubject::EnjuManifestation include EnjuNdl::EnjuManifestation include EnjuNii::EnjuManifestation include EnjuLoc::EnjuManifestation include EnjuManifestationViewer::EnjuManifestation include EnjuBookmark::EnjuMa...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/country.rb
app/models/country.rb
class Country < ApplicationRecord include MasterModel default_scope { order("countries.position") } has_many :agents, dependent: :destroy has_many :libraries, dependent: :destroy has_one :library_group # If you wish to change the field names for brevity, feel free to enable/modify these. # alias_attribut...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/message_state_machine.rb
app/models/message_state_machine.rb
class MessageStateMachine include Statesman::Machine state :pending, initial: true state :unread state :read transition from: :pending, to: :unread transition from: :pending, to: :read transition from: :unread, to: :read transition from: :read, to: :unread before_transition(from: :pending, to: :rea...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/realize.rb
app/models/realize.rb
class Realize < ApplicationRecord belongs_to :agent belongs_to :expression, class_name: "Manifestation", touch: true belongs_to :realize_type, optional: true validates :expression_id, uniqueness: { scope: :agent_id } after_destroy :reindex after_save :reindex acts_as_list scope: :expression def reind...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/picture_file.rb
app/models/picture_file.rb
class PictureFile < ApplicationRecord scope :attached, -> { where.not(picture_attachable_id: nil) } belongs_to :picture_attachable, polymorphic: true has_one_attached :attachment validates :picture_attachable_type, presence: true, inclusion: { in: [ "Event", "Manifestation", "Agent", "Shelf" ] } validates_a...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/user_reserve_stat_state_machine.rb
app/models/user_reserve_stat_state_machine.rb
class UserReserveStatStateMachine include Statesman::Machine state :pending, initial: true state :started state :completed transition from: :pending, to: :started transition from: :started, to: :completed after_transition(to: :started) do |user_reserve_stat| user_reserve_stat.update_column(:started_...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/agent_import_file_transition.rb
app/models/agent_import_file_transition.rb
class AgentImportFileTransition < ApplicationRecord belongs_to :agent_import_file, inverse_of: :agent_import_file_transitions end # == Schema Information # # Table name: agent_import_file_transitions # # id :bigint not null, primary key # metadata :jsonb not null ...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/carrier_type_has_checkout_type.rb
app/models/carrier_type_has_checkout_type.rb
class CarrierTypeHasCheckoutType < ApplicationRecord scope :available_for_carrier_type, lambda { |carrier_type| includes(:carrier_type).where("carrier_types.name = ?", carrier_type.name) } scope :available_for_user_group, lambda { |user_group| includes(checkout_type: :user_groups).where("user_groups.name = ?", user...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/user_import_result.rb
app/models/user_import_result.rb
class UserImportResult < ApplicationRecord scope :file_id, proc { |file_id| where(user_import_file_id: file_id) } scope :failed, -> { where(user_id: nil) } belongs_to :user_import_file belongs_to :user, optional: true end # == Schema Information # # Table name: user_import_results # # id :bi...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/user_import_file.rb
app/models/user_import_file.rb
class UserImportFile < ApplicationRecord include Statesman::Adapters::ActiveRecordQueries[ transition_class: UserImportFileTransition, initial_state: UserImportFileStateMachine.initial_state ] include ImportFile default_scope { order("user_import_files.id DESC") } scope :not_imported, -> { in_state(:p...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/ndl_book.rb
app/models/ndl_book.rb
class NdlBook def initialize(node) @node = node end def jpno @node.at('./dc:identifier[@xsi:type="dcndl:JPNO"]').try(:content).to_s end def permalink @node.at("./link").try(:content).to_s end def itemno URI.parse(permalink).path.split("/").last end def title @node.at("./title")...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/subject_heading_type.rb
app/models/subject_heading_type.rb
class SubjectHeadingType < ApplicationRecord include MasterModel has_many :subjects, dependent: :destroy validates :name, format: { with: /\A[0-9a-z][0-9a-z_\-]*[0-9a-z]\Z/ } end # == Schema Information # # Table name: subject_heading_types # # id :bigint not null, primary key # display_nam...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/own.rb
app/models/own.rb
class Own < ApplicationRecord belongs_to :agent belongs_to :item validates :item_id, uniqueness: { scope: :agent_id } after_destroy :reindex after_save :reindex acts_as_list scope: :item attr_accessor :item_identifier def reindex agent.try(:index) item.try(:index) end end # == Schema Info...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/series_statement_merge_list.rb
app/models/series_statement_merge_list.rb
class SeriesStatementMergeList < ApplicationRecord has_many :series_statement_merges, dependent: :destroy has_many :series_statements, through: :series_statement_merges validates :title, presence: true paginates_per 10 end # == Schema Information # # Table name: series_statement_merge_lists # # id :b...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/news_post.rb
app/models/news_post.rb
class NewsPost < ApplicationRecord scope :published, -> { where(draft: false) } scope :current, -> { where("start_date <= ? AND end_date >= ?", Time.zone.now, Time.zone.now) } default_scope { order("news_posts.start_date DESC") } belongs_to :user belongs_to :required_role, class_name: "Role" validates :tit...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/ndla_record.rb
app/models/ndla_record.rb
class NdlaRecord < ApplicationRecord belongs_to :agent validates :body, presence: true, uniqueness: true end # == Schema Information # # Table name: ndla_records # # id :bigint not null, primary key # body :string not null # created_at :datetime not null # updated_at :...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/bookmark_stat.rb
app/models/bookmark_stat.rb
class BookmarkStat < ApplicationRecord include Statesman::Adapters::ActiveRecordQueries[ transition_class: UserCheckoutStatTransition, initial_state: UserCheckoutStatStateMachine.initial_state ] include CalculateStat default_scope { order("bookmark_stats.id DESC") } scope :not_calculated, -> { in_stat...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/loc_search.rb
app/models/loc_search.rb
class LocSearch def initialize(node) @node = node end class ModsRecord < LocSearch MODS_NS = { "mods" => "http://www.loc.gov/mods/v3" } def title title = @node.xpath(".//mods:titleInfo/mods:title", MODS_NS).first.content subtitle = @node.xpath(".//mods:titleInfo/mods:subTitle", MODS_NS).f...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/agent_import_result.rb
app/models/agent_import_result.rb
class AgentImportResult < ApplicationRecord default_scope { order("agent_import_results.id") } scope :file_id, proc { |file_id| where(agent_import_file_id: file_id) } scope :failed, -> { where(agent_id: nil) } belongs_to :agent_import_file belongs_to :agent, optional: true end # == Schema Information # # Ta...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/realize_type.rb
app/models/realize_type.rb
class RealizeType < ApplicationRecord include MasterModel default_scope { order("realize_types.position") } end # == Schema Information # # Table name: realize_types # # id :bigint not null, primary key # display_name :text # name :string not null # note :text # p...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/resourcesync.rb
app/models/resourcesync.rb
class Resourcesync def initialize @base_url = if ENV["ENJU_LEAF_RESOURCESYNC_BASE_URL"].present? URI.parse(ENV["ENJU_LEAF_RESOURCESYNC_BASE_URL"]).to_s else URI.parse(ENV["ENJU_LEAF_BASE_URL"]).to_s end end def generate_capabilitylist capabilitylist = Resync::C...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/user_import_file_transition.rb
app/models/user_import_file_transition.rb
class UserImportFileTransition < ApplicationRecord belongs_to :user_import_file, inverse_of: :user_import_file_transitions end # == Schema Information # # Table name: user_import_file_transitions # # id :bigint not null, primary key # metadata :jsonb not null # mos...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/color.rb
app/models/color.rb
class Color < ApplicationRecord belongs_to :library_group validates :code, presence: true, format: /\A[A-Fa-f0-9]{6}\Z/ validates :property, presence: true, uniqueness: true, format: /\A[a-z][0-9a-z_]*[0-9a-z]\Z/ acts_as_list end # == Schema Information # # Table name: colors # # id :bigint ...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/event_export_file_state_machine.rb
app/models/event_export_file_state_machine.rb
class EventExportFileStateMachine include Statesman::Machine state :pending, initial: true state :started state :completed state :failed transition from: :pending, to: :started transition from: :started, to: [ :completed, :failed ] after_transition(from: :pending, to: :started) do |event_export_file|...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/checked_item.rb
app/models/checked_item.rb
class CheckedItem < ApplicationRecord belongs_to :item, optional: true belongs_to :basket belongs_to :librarian, class_name: "User", optional: true validates_associated :item, :basket, on: :update validates :item, :basket, :due_date, presence: { on: :update } validates :item_id, uniqueness: { scope: :baske...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/carrier_type.rb
app/models/carrier_type.rb
class CarrierType < ApplicationRecord include MasterModel include EnjuCirculation::EnjuCarrierType has_many :manifestations, dependent: :restrict_with_exception has_one_attached :attachment before_save do attachment.purge if delete_attachment == "1" end attr_accessor :delete_attachment def mods_t...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/manifestation_relationship.rb
app/models/manifestation_relationship.rb
class ManifestationRelationship < ApplicationRecord belongs_to :parent, class_name: "Manifestation" belongs_to :child, class_name: "Manifestation" belongs_to :manifestation_relationship_type, optional: true validate :check_parent acts_as_list scope: :parent_id def check_parent if parent_id == child_id ...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/bookmark_stat_transition.rb
app/models/bookmark_stat_transition.rb
class BookmarkStatTransition < ApplicationRecord belongs_to :bookmark_stat, inverse_of: :bookmark_stat_transitions end # == Schema Information # # Table name: bookmark_stat_transitions # # id :bigint not null, primary key # metadata :jsonb not null # most_recent :bo...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/message.rb
app/models/message.rb
class Message < ApplicationRecord include Statesman::Adapters::ActiveRecordQueries[ transition_class: MessageTransition, initial_state: MessageStateMachine.initial_state ] scope :unread, -> { in_state("unread") } belongs_to :sender, class_name: "User" belongs_to :receiver, class_name: "User" validat...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/user_checkout_stat_state_machine.rb
app/models/user_checkout_stat_state_machine.rb
class UserCheckoutStatStateMachine include Statesman::Machine state :pending, initial: true state :started state :completed transition from: :pending, to: :started transition from: :started, to: :completed after_transition(to: :started) do |user_checkout_stat| user_checkout_stat.update_column(:start...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/reserve_state_machine.rb
app/models/reserve_state_machine.rb
class ReserveStateMachine include Statesman::Machine state :pending, initial: true state :postponed state :requested state :retained state :canceled state :expired state :completed transition from: :pending, to: [ :requested ] transition from: :postponed, to: [ :requested, :retained, :canceled, :ex...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/resource_import_file_state_machine.rb
app/models/resource_import_file_state_machine.rb
class ResourceImportFileStateMachine include Statesman::Machine state :pending, initial: true state :started state :completed state :failed transition from: :pending, to: [ :started, :failed ] transition from: :started, to: [ :completed, :failed ] after_transition(from: :pending, to: :started) do |re...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/event_import_file.rb
app/models/event_import_file.rb
class EventImportFile < ApplicationRecord include Statesman::Adapters::ActiveRecordQueries[ transition_class: EventImportFileTransition, initial_state: EventImportFileStateMachine.initial_state ] include ImportFile scope :not_imported, -> { in_state(:pending) } scope :stucked, -> { in_state(:pending)....
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/lccn_record.rb
app/models/lccn_record.rb
class LccnRecord < ApplicationRecord belongs_to :manifestation validates :body, presence: true, uniqueness: true end # == Schema Information # # Table name: lccn_records # # id :bigint not null, primary key # body :string not null # created_at :datetime ...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/user_import_file_state_machine.rb
app/models/user_import_file_state_machine.rb
class UserImportFileStateMachine include Statesman::Machine state :pending, initial: true state :started state :completed state :failed transition from: :pending, to: [ :started, :failed ] transition from: :started, to: [ :completed, :failed ] after_transition(from: :pending, to: :started) do |user_i...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/classification_type.rb
app/models/classification_type.rb
class ClassificationType < ApplicationRecord include MasterModel has_many :classifications, dependent: :restrict_with_exception validates :name, format: { with: /\A[0-9a-z][0-9a-z_\-]*[0-9a-z]\Z/ } end # == Schema Information # # Table name: classification_types # # id :bigint not null, prim...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/application_record.rb
app/models/application_record.rb
class ApplicationRecord < ActiveRecord::Base self.abstract_class = true end
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/bookmark_stat_has_manifestation.rb
app/models/bookmark_stat_has_manifestation.rb
class BookmarkStatHasManifestation < ApplicationRecord belongs_to :bookmark_stat belongs_to :manifestation validates_uniqueness_of :manifestation_id, scope: :bookmark_stat_id paginates_per 10 end # == Schema Information # # Table name: bookmark_stat_has_manifestations # # id :bigint ...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/create.rb
app/models/create.rb
class Create < ApplicationRecord belongs_to :agent belongs_to :work, class_name: "Manifestation", touch: true belongs_to :create_type, optional: true validates :work_id, uniqueness: { scope: :agent_id } after_destroy :reindex after_save :reindex acts_as_list scope: :work def reindex agent.try(:in...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/search_engine.rb
app/models/search_engine.rb
class SearchEngine < ApplicationRecord acts_as_list validates :name, presence: true validates :query_param, presence: true validates :http_method, presence: true, inclusion: %w[get post] validates :url, presence: true, url: true, length: { maximum: 255 } validates :base_url, presence: true, url: true, leng...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/manifestation_checkout_stat.rb
app/models/manifestation_checkout_stat.rb
class ManifestationCheckoutStat < ApplicationRecord include Statesman::Adapters::ActiveRecordQueries[ transition_class: ManifestationCheckoutStatTransition, initial_state: ManifestationCheckoutStatStateMachine.initial_state ] include CalculateStat default_scope { order("manifestation_checkout_stats.id D...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/subscribe.rb
app/models/subscribe.rb
class Subscribe < ApplicationRecord belongs_to :subscription, counter_cache: true belongs_to :work, class_name: "Manifestation" validates :start_at, :end_at, presence: true validates :work_id, uniqueness: { scope: :subscription_id } end # == Schema Information # # Table name: subscribes # # id :...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/manifestation_checkout_stat_transition.rb
app/models/manifestation_checkout_stat_transition.rb
class ManifestationCheckoutStatTransition < ApplicationRecord belongs_to :manifestation_checkout_stat, inverse_of: :manifestation_checkout_stat_transitions end # == Schema Information # # Table name: manifestation_checkout_stat_transitions # # id :bigint not null, primary key #...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/inventory_file.rb
app/models/inventory_file.rb
class InventoryFile < ApplicationRecord has_many :inventories, dependent: :destroy has_many :items, through: :inventories belongs_to :user belongs_to :shelf, optional: true has_one_attached :attachment attr_accessor :library_id paginates_per 10 def import reload reader = attachment.download ...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/series_statement_merge.rb
app/models/series_statement_merge.rb
class SeriesStatementMerge < ApplicationRecord belongs_to :series_statement belongs_to :series_statement_merge_list paginates_per 10 end # == Schema Information # # Table name: series_statement_merges # # id :bigint not null, primary key # created_at :...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/event_import_file_transition.rb
app/models/event_import_file_transition.rb
class EventImportFileTransition < ApplicationRecord belongs_to :event_import_file, inverse_of: :event_import_file_transitions end # == Schema Information # # Table name: event_import_file_transitions # # id :bigint not null, primary key # metadata :jsonb not null ...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/user_export_file_state_machine.rb
app/models/user_export_file_state_machine.rb
class UserExportFileStateMachine include Statesman::Machine state :pending, initial: true state :started state :completed state :failed transition from: :pending, to: [ :started, :failed ] transition from: :started, to: [ :completed, :failed ] after_transition(from: :pending, to: :started) do |user_e...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/resource_import_file_transition.rb
app/models/resource_import_file_transition.rb
class ResourceImportFileTransition < ApplicationRecord belongs_to :resource_import_file, inverse_of: :resource_import_file_transitions end # == Schema Information # # Table name: resource_import_file_transitions # # id :bigint not null, primary key # metadata :jsonb ...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/event_export_file.rb
app/models/event_export_file.rb
class EventExportFile < ApplicationRecord include Statesman::Adapters::ActiveRecordQueries[ transition_class: EventExportFileTransition, initial_state: EventExportFileStateMachine.initial_state ] include ExportFile has_one_attached :attachment has_many :event_export_file_transitions, autosave: false ...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/profile.rb
app/models/profile.rb
class Profile < ApplicationRecord include EnjuCirculation::EnjuProfile scope :administrators, -> { joins(user: :role).where("roles.name = ?", "Administrator") } scope :librarians, -> { joins(user: :role).where("roles.name = ? OR roles.name = ?", "Administrator", "Librarian") } has_one :user, dependent: :destroy...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/user_group_has_checkout_type.rb
app/models/user_group_has_checkout_type.rb
class UserGroupHasCheckoutType < ApplicationRecord scope :available_for_item, lambda { |item| where(checkout_type_id: item.checkout_type.id) } scope :available_for_carrier_type, lambda { |carrier_type| includes(checkout_type: :carrier_types).where("carrier_types.id" => carrier_type.id) } belongs_to :user_group ...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/library_group.rb
app/models/library_group.rb
class LibraryGroup < ApplicationRecord # include Singleton include MasterModel has_many :libraries, dependent: :destroy has_many :colors, dependent: :destroy belongs_to :country, optional: true validates :url, presence: true, url: true validates :short_name, presence: true validates :max_number_of_res...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/event_export_file_transition.rb
app/models/event_export_file_transition.rb
class EventExportFileTransition < ApplicationRecord belongs_to :event_export_file, inverse_of: :event_export_file_transitions end # == Schema Information # # Table name: event_export_file_transitions # # id :bigint not null, primary key # metadata :jsonb not null ...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/withdraw.rb
app/models/withdraw.rb
class Withdraw < ApplicationRecord include EnjuCirculation::EnjuWithdraw belongs_to :basket belongs_to :item, touch: true belongs_to :librarian, class_name: "User" validates :item_id, uniqueness: true # { message: I18n.t('withdraw.already_withdrawn', locale: I18n.default_locale) } attr_accessor :item_...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/order_list_transition.rb
app/models/order_list_transition.rb
class OrderListTransition < ApplicationRecord belongs_to :order_list, inverse_of: :order_list_transitions end # == Schema Information # # Table name: order_list_transitions # # id :bigint not null, primary key # metadata :jsonb not null # most_recent :boolean not nu...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/reserve_transition.rb
app/models/reserve_transition.rb
class ReserveTransition < ApplicationRecord belongs_to :reserve, inverse_of: :reserve_transitions end # == Schema Information # # Table name: reserve_transitions # # id :bigint not null, primary key # metadata :jsonb not null # most_recent :boolean not null # sort_key ...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/user_has_role.rb
app/models/user_has_role.rb
class UserHasRole < ApplicationRecord belongs_to :user belongs_to :role accepts_nested_attributes_for :role end # == Schema Information # # Table name: user_has_roles # # id :bigint not null, primary key # created_at :datetime not null # updated_at :datetime not null # role_...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/role.rb
app/models/role.rb
class Role < ApplicationRecord include MasterModel validates :name, presence: true, format: { with: /\A[A-Za-z][a-z_,]*[a-z]\z/ } has_many :user_has_roles, dependent: :destroy has_many :users, through: :user_has_roles extend FriendlyId friendly_id :name def localized_name display_name.localize end...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/issn_record.rb
app/models/issn_record.rb
class IssnRecord < ApplicationRecord has_many :issn_record_and_manifestations, dependent: :destroy has_many :manifestations, through: :issn_record_and_manifestations validates :body, presence: true, uniqueness: true before_save :normalize_issn strip_attributes def normalize_issn if StdNum::ISSN.valid?(...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/doi_record.rb
app/models/doi_record.rb
class DoiRecord < ApplicationRecord belongs_to :manifestation validates :body, presence: true, uniqueness: true end # == Schema Information # # Table name: doi_records # # id :bigint not null, primary key # body :string not null # created_at :datetime ...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/user_export_file.rb
app/models/user_export_file.rb
class UserExportFile < ApplicationRecord include Statesman::Adapters::ActiveRecordQueries[ transition_class: UserExportFileTransition, initial_state: UserExportFileStateMachine.initial_state ] include ExportFile has_one_attached :attachment has_many :user_export_file_transitions, autosave: false, de...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/item_custom_value.rb
app/models/item_custom_value.rb
class ItemCustomValue < ApplicationRecord belongs_to :item_custom_property belongs_to :item validates :item_custom_property, uniqueness: { scope: :item_id } end # == Schema Information # # Table name: item_custom_values # # id :bigint not null, primary key # value ...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/item_has_use_restriction.rb
app/models/item_has_use_restriction.rb
class ItemHasUseRestriction < ApplicationRecord belongs_to :item belongs_to :use_restriction accepts_nested_attributes_for :use_restriction validates :item, presence: { on: :update } paginates_per 10 end # == Schema Information # # Table name: item_has_use_restrictions # # id :bigint ...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/manifestation_reserve_stat.rb
app/models/manifestation_reserve_stat.rb
class ManifestationReserveStat < ApplicationRecord include Statesman::Adapters::ActiveRecordQueries[ transition_class: ManifestationReserveStatTransition, initial_state: ManifestationReserveStatStateMachine.initial_state ] include CalculateStat default_scope { order("manifestation_reserve_stats.id DESC"...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/subject.rb
app/models/subject.rb
class Subject < ApplicationRecord belongs_to :manifestation, touch: true, optional: true belongs_to :subject_type belongs_to :subject_heading_type belongs_to :required_role, class_name: "Role" validates :term, presence: true searchable do text :term time :created_at integer :required_role_id ...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/inventory.rb
app/models/inventory.rb
class Inventory < ApplicationRecord belongs_to :item, optional: true belongs_to :inventory_file validates :item_identifier, :current_shelf_name, presence: true validates :item_id, :item_identifier, uniqueness: { scope: :inventory_file_id } paginates_per 10 def to_hash { created_at: created_at, ...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/checkout_type.rb
app/models/checkout_type.rb
class CheckoutType < ApplicationRecord include MasterModel scope :available_for_carrier_type, lambda { |carrier_type| includes(:carrier_types).where("carrier_types.name = ?", carrier_type.name).order("carrier_types.position") } scope :available_for_user_group, lambda { |user_group| includes(:user_groups).where("u...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/create_type.rb
app/models/create_type.rb
class CreateType < ApplicationRecord include MasterModel default_scope { order("create_types.position") } end # == Schema Information # # Table name: create_types # # id :bigint not null, primary key # display_name :text # name :string not null # note :text # posi...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/accept.rb
app/models/accept.rb
class Accept < ApplicationRecord include EnjuCirculation::EnjuAccept default_scope { order("accepts.id DESC") } belongs_to :basket belongs_to :item, touch: true belongs_to :librarian, class_name: "User" validates :item_id, uniqueness: true # , message: I18n.t('accept.already_accepted') attr_accessor :i...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/manifestation_custom_value.rb
app/models/manifestation_custom_value.rb
class ManifestationCustomValue < ApplicationRecord belongs_to :manifestation_custom_property belongs_to :manifestation validates :manifestation_custom_property, uniqueness: { scope: :manifestation_id } end # == Schema Information # # Table name: manifestation_custom_values # # id :...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/bookmark.rb
app/models/bookmark.rb
class Bookmark < ApplicationRecord scope :bookmarked, lambda { |start_date, end_date| where("created_at >= ? AND created_at < ?", start_date, end_date) } scope :user_bookmarks, lambda { |user| where(user_id: user.id) } scope :shared, -> { where(shared: true) } belongs_to :manifestation, touch: true, optional: t...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/resource_export_file_state_machine.rb
app/models/resource_export_file_state_machine.rb
class ResourceExportFileStateMachine include Statesman::Machine state :pending, initial: true state :started state :completed state :failed transition from: :pending, to: [ :started, :failed ] transition from: :started, to: [ :completed, :failed ] after_transition(from: :pending, to: :started) do |re...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/resource_import_result.rb
app/models/resource_import_result.rb
class ResourceImportResult < ApplicationRecord default_scope { order("resource_import_results.id") } scope :file_id, proc { |file_id| where(resource_import_file_id: file_id) } scope :failed, -> { where(manifestation_id: nil) } scope :skipped, -> { where.not(error_message: nil) } belongs_to :resource_import_f...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false
next-l/enju_leaf
https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/models/series_statement.rb
app/models/series_statement.rb
class SeriesStatement < ApplicationRecord has_many :series_statement_merges, dependent: :destroy has_many :series_statement_merge_lists, through: :series_statement_merges belongs_to :manifestation, touch: true, optional: true belongs_to :root_manifestation, class_name: "Manifestation", touch: true, optional: tr...
ruby
MIT
cd3cff6dcc8e67909e1cd0a12c38700b45af6a42
2026-01-04T17:52:15.550406Z
false