Sha256: bd81d27be4f80259be4c9bf24cd1e82a191b159ab7afecc9a963eed248465c2d
Contents?: true
Size: 942 Bytes
Versions: 12
Compression:
Stored size: 942 Bytes
Contents
module EnjuLibrary module LibraryItem def self.included(base) base.extend ClassMethods end module ClassMethods def enju_library_item_model include InstanceMethods has_one :accept scope :accepted_between, lambda{|from, to| includes(:accept).where('items.created_at BETWEEN ? AND ?', Time.zone.parse(from).beginning_of_day, Time.zone.parse(to).end_of_day)} belongs_to :shelf, counter_cache: true, validate: true validates_associated :shelf searchable do string :library do shelf.library.name if shelf end end end end module InstanceMethods def shelf_name shelf.name end def hold?(library) return true if shelf.library == library false end def library_url "#{LibraryGroup.site_config.url}libraries/#{shelf.library.name}" end end end end
Version data entries
12 entries across 12 versions & 1 rubygems