Class: Item

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#library_idObject

Returns the value of attribute library_id.



56
57
58
# File 'app/models/item.rb', line 56

def library_id
  @library_id
end

Instance Method Details

#contributorObject



68
69
70
# File 'app/models/item.rb', line 68

def contributor
  manifestation.try(:contributor)
end

#creatorObject



64
65
66
# File 'app/models/item.rb', line 64

def creator
  manifestation.try(:creator)
end

#manifestation_urlObject



80
81
82
# File 'app/models/item.rb', line 80

def manifestation_url
  Addressable::URI.parse("#{LibraryGroup.site_config.url}manifestations/#{self.manifestation.id}").normalize.to_s if self.manifestation
end

#owned(agent) ⇒ Object



76
77
78
# File 'app/models/item.rb', line 76

def owned(agent)
  owns.where(agent_id: agent.id).first
end

#publisherObject



72
73
74
# File 'app/models/item.rb', line 72

def publisher
  manifestation.try(:publisher)
end

#removable?Boolean



84
85
86
87
88
89
90
91
92
# File 'app/models/item.rb', line 84

def removable?
  if defined?(EnjuCirculation)
    return false if circulation_status.name == 'Removed'
    return false if checkouts.not_returned.exists?
    true
  else
    true
  end
end

#titleObject



60
61
62
# File 'app/models/item.rb', line 60

def title
  manifestation.try(:original_title)
end