Class: Item
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Item
- Defined in:
- app/models/item.rb
Instance Attribute Summary collapse
-
#library_id ⇒ Object
Returns the value of attribute library_id.
Instance Method Summary collapse
- #contributor ⇒ Object
- #creator ⇒ Object
- #manifestation_url ⇒ Object
- #owned(agent) ⇒ Object
- #publisher ⇒ Object
- #removable? ⇒ Boolean
- #title ⇒ Object
Instance Attribute Details
#library_id ⇒ Object
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
#contributor ⇒ Object
68 69 70 |
# File 'app/models/item.rb', line 68 def contributor manifestation.try(:contributor) end |
#creator ⇒ Object
64 65 66 |
# File 'app/models/item.rb', line 64 def creator manifestation.try(:creator) end |
#manifestation_url ⇒ Object
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 |
#publisher ⇒ Object
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 |
#title ⇒ Object
60 61 62 |
# File 'app/models/item.rb', line 60 def title manifestation.try(:original_title) end |