enju_standalone_interface 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +3 -0
  3. data/Rakefile +35 -0
  4. data/app/assets/javascripts/enju_standalone_interface/application.js +15 -0
  5. data/app/assets/javascripts/enju_standalone_interface/batch_action.js +2 -0
  6. data/app/assets/stylesheets/enju_standalone_interface/application.css +13 -0
  7. data/app/assets/stylesheets/enju_standalone_interface/batch_action.css +4 -0
  8. data/app/controllers/application_controller.rb +4 -0
  9. data/app/controllers/batch_action_controller.rb +9 -0
  10. data/app/helpers/enju_standalone_interface/application_helper.rb +4 -0
  11. data/app/helpers/enju_standalone_interface/batch_action_helper.rb +4 -0
  12. data/app/views/enju_standalone_interface/batch_action/recept.html.erb +1 -0
  13. data/app/views/layouts/enju_standalone_interface/application.html.erb +14 -0
  14. data/config/routes.rb +3 -0
  15. data/lib/enju_standalone_interface.rb +233 -0
  16. data/lib/enju_standalone_interface/engine.rb +5 -0
  17. data/lib/enju_standalone_interface/version.rb +3 -0
  18. data/lib/tasks/enju_standalone_interface_tasks.rake +4 -0
  19. data/spec/controllers/enju_standalone_interface/batch_action_controller_spec.rb +21 -0
  20. data/spec/dummy/README.rdoc +261 -0
  21. data/spec/dummy/Rakefile +7 -0
  22. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  23. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  24. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  25. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  26. data/spec/dummy/app/helpers/users_helper.rb +36 -0
  27. data/spec/dummy/app/models/basket.rb +70 -0
  28. data/spec/dummy/app/models/carrier_type.rb +33 -0
  29. data/spec/dummy/app/models/checked_item.rb +177 -0
  30. data/spec/dummy/app/models/checkout.rb +307 -0
  31. data/spec/dummy/app/models/checkout_type.rb +33 -0
  32. data/spec/dummy/app/models/circulation_status.rb +23 -0
  33. data/spec/dummy/app/models/event.rb +124 -0
  34. data/spec/dummy/app/models/item.rb +1234 -0
  35. data/spec/dummy/app/models/item_has_use_restriction.rb +23 -0
  36. data/spec/dummy/app/models/lending_policy.rb +32 -0
  37. data/spec/dummy/app/models/library.rb +105 -0
  38. data/spec/dummy/app/models/library_group.rb +88 -0
  39. data/spec/dummy/app/models/manifestation.rb +698 -0
  40. data/spec/dummy/app/models/patron.rb +342 -0
  41. data/spec/dummy/app/models/role.rb +47 -0
  42. data/spec/dummy/app/models/shelf.rb +83 -0
  43. data/spec/dummy/app/models/use_restriction.rb +22 -0
  44. data/spec/dummy/app/models/user.rb +580 -0
  45. data/spec/dummy/app/models/user_group.rb +43 -0
  46. data/spec/dummy/app/models/user_group_has_checkout_type.rb +80 -0
  47. data/spec/dummy/app/models/user_has_role.rb +4 -0
  48. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  49. data/spec/dummy/config.ru +4 -0
  50. data/spec/dummy/config/application.rb +57 -0
  51. data/spec/dummy/config/boot.rb +10 -0
  52. data/spec/dummy/config/database.yml +25 -0
  53. data/spec/dummy/config/environment.rb +5 -0
  54. data/spec/dummy/config/environments/development.rb +37 -0
  55. data/spec/dummy/config/environments/production.rb +67 -0
  56. data/spec/dummy/config/environments/test.rb +37 -0
  57. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  58. data/spec/dummy/config/initializers/inflections.rb +15 -0
  59. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  60. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  61. data/spec/dummy/config/initializers/session_store.rb +8 -0
  62. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  63. data/spec/dummy/config/locales/en.yml +5 -0
  64. data/spec/dummy/config/locales/translation_en.yml +1724 -0
  65. data/spec/dummy/config/locales/validates_timeliness.en.yml +16 -0
  66. data/spec/dummy/config/routes.rb +4 -0
  67. data/spec/dummy/db/development.sqlite3 +0 -0
  68. data/spec/dummy/db/migrate/20120322223037_create_users.rb +71 -0
  69. data/spec/dummy/db/migrate/20120323053037_create_roles.rb +15 -0
  70. data/spec/dummy/db/migrate/20120323060718_create_user_has_roles.rb +10 -0
  71. data/spec/dummy/db/migrate/20120323062239_create_libraries.rb +37 -0
  72. data/spec/dummy/db/migrate/20120323063602_create_items.rb +33 -0
  73. data/spec/dummy/db/migrate/20120323064619_craete_circulation_statuses.rb +13 -0
  74. data/spec/dummy/db/migrate/20120323065157_craete_checkout_types.rb +13 -0
  75. data/spec/dummy/db/migrate/20120323070102_craete_shelves.rb +17 -0
  76. data/spec/dummy/db/migrate/20120323071616_craete_library_groups.rb +24 -0
  77. data/spec/dummy/db/migrate/20120323073022_craete_patrons.rb +72 -0
  78. data/spec/dummy/db/migrate/20120323141030_create_manifestations.rb +97 -0
  79. data/spec/dummy/db/migrate/20120323142330_create_carrier_types.rb +12 -0
  80. data/spec/dummy/db/migrate/20120324132708_create_baskets.rb +20 -0
  81. data/spec/dummy/db/migrate/20120324135409_checked_items.rb +16 -0
  82. data/spec/dummy/db/migrate/20120324141007_create_user_groups.rb +22 -0
  83. data/spec/dummy/db/migrate/20120324141950_create_user_group_has_checkout_type.rb +26 -0
  84. data/spec/dummy/db/migrate/20120324151951_create_lending_policies.rb +22 -0
  85. data/spec/dummy/db/migrate/20120324153756_create_use_restrictions.rb +15 -0
  86. data/spec/dummy/db/migrate/20120324154009_create_item_has_use_restrictions.rb +16 -0
  87. data/spec/dummy/db/migrate/20120324164815_create_checkouts.rb +26 -0
  88. data/spec/dummy/db/migrate/20120325160112_create_events.rb +23 -0
  89. data/spec/dummy/db/schema.rb +518 -0
  90. data/spec/dummy/db/test.sqlite3 +0 -0
  91. data/spec/dummy/lib/enju_leaf.rb +6 -0
  92. data/spec/dummy/lib/enju_leaf/master_model.rb +41 -0
  93. data/spec/dummy/lib/enju_leaf/url_validator.rb +10 -0
  94. data/spec/dummy/log/development.log +116 -0
  95. data/spec/dummy/log/test.log +17849 -0
  96. data/spec/dummy/public/404.html +26 -0
  97. data/spec/dummy/public/422.html +26 -0
  98. data/spec/dummy/public/500.html +25 -0
  99. data/spec/dummy/public/favicon.ico +0 -0
  100. data/spec/dummy/script/rails +6 -0
  101. data/spec/factories/item.rb +9 -0
  102. data/spec/factories/manifestation.rb +6 -0
  103. data/spec/factories/user.rb +27 -0
  104. data/spec/fixtures/carrier_types.yml +38 -0
  105. data/spec/fixtures/checkout_types.yml +34 -0
  106. data/spec/fixtures/circulation_statuses.yml +135 -0
  107. data/spec/fixtures/libraries.yml +40 -0
  108. data/spec/fixtures/roles.yml +21 -0
  109. data/spec/fixtures/shelves.yml +53 -0
  110. data/spec/fixtures/user_group_has_checkout_types.yml +14 -0
  111. data/spec/fixtures/user_groups.yml +7 -0
  112. data/spec/libs/enju_standalone_interface_spec.rb +133 -0
  113. data/spec/spec_helper.rb +36 -0
  114. metadata +358 -0
@@ -0,0 +1,342 @@
1
+ # -*- encoding: utf-8 -*-
2
+ class Patron < ActiveRecord::Base
3
+ scope :readable_by, lambda{|user| {:conditions => ['required_role_id <= ?', user.try(:user_has_role).try(:role_id) || Role.where(:name => 'Guest').select(:id).first.id]}}
4
+ has_many :creates, :dependent => :destroy
5
+ has_many :works, :through => :creates
6
+ has_many :realizes, :dependent => :destroy
7
+ has_many :expressions, :through => :realizes
8
+ has_many :produces, :dependent => :destroy
9
+ has_many :manifestations, :through => :produces
10
+ has_many :children, :foreign_key => 'parent_id', :class_name => 'PatronRelationship', :dependent => :destroy
11
+ has_many :parents, :foreign_key => 'child_id', :class_name => 'PatronRelationship', :dependent => :destroy
12
+ has_many :derived_patrons, :through => :children, :source => :child
13
+ has_many :original_patrons, :through => :parents, :source => :parent
14
+ has_many :picture_files, :as => :picture_attachable, :dependent => :destroy
15
+ has_many :donates
16
+ has_many :donated_items, :through => :donates, :source => :item
17
+ has_many :owns, :dependent => :destroy
18
+ has_many :items, :through => :owns
19
+ has_many :patron_merges, :dependent => :destroy
20
+ has_many :patron_merge_lists, :through => :patron_merges
21
+ belongs_to :user
22
+ belongs_to :patron_type
23
+ belongs_to :required_role, :class_name => 'Role', :foreign_key => 'required_role_id', :validate => true
24
+ belongs_to :language
25
+ belongs_to :country
26
+ has_one :patron_import_result
27
+
28
+ validates_presence_of :language, :patron_type, :country
29
+ validates_associated :language, :patron_type, :country
30
+ validates :full_name, :presence => true, :length => {:maximum => 255}
31
+ validates :user_id, :uniqueness => true, :allow_nil => true
32
+ validates :birth_date, :format => {:with => /^\d+(-\d{0,2}){0,2}$/}, :allow_blank => true
33
+ validates :death_date, :format => {:with => /^\d+(-\d{0,2}){0,2}$/}, :allow_blank => true
34
+ validates :email, :format => {:with => /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i}, :allow_blank => true
35
+ validate :check_birth_date
36
+ before_validation :set_role_and_name
37
+ before_save :set_date_of_birth, :set_date_of_death, :change_note
38
+
39
+ validate :check_duplicate_user
40
+
41
+ #has_paper_trail
42
+ attr_accessor :user_username
43
+ #[:address_1, :address_2].each do |column|
44
+ # encrypt_with_public_key column,
45
+ # :key_pair => File.join(Rails.root.to_s,'config','keypair.pem'),
46
+ # :base64 => true
47
+ #end
48
+
49
+ def self.per_page
50
+ 10
51
+ end
52
+
53
+ def full_name_without_space
54
+ full_name.gsub(/\s/, "")
55
+ end
56
+
57
+ def set_role_and_name
58
+ self.required_role = Role.where(:name => 'Librarian').first if self.required_role_id.nil?
59
+ set_full_name
60
+ end
61
+
62
+ def set_full_name
63
+ if self.full_name.blank?
64
+ if self.last_name.to_s.strip and self.first_name.to_s.strip and SystemConfiguration.get("family_name_first") == true
65
+ self.full_name = [last_name, middle_name, first_name].compact.join(" ").to_s.strip
66
+ else
67
+ self.full_name = [first_name, last_name, middle_name].compact.join(" ").to_s.strip
68
+ end
69
+ end
70
+ if self.full_name_transcription.blank?
71
+ self.full_name_transcription = [last_name_transcription, middle_name_transcription, first_name_transcription].join(" ").to_s.strip
72
+ end
73
+ [self.full_name, self.full_name_transcription]
74
+ end
75
+
76
+ def set_date_of_birth
77
+ return if birth_date.blank?
78
+ begin
79
+ date = Time.zone.parse("#{birth_date}")
80
+ rescue ArgumentError
81
+ begin
82
+ date = Time.zone.parse("#{birth_date}-01")
83
+ rescue ArgumentError
84
+ begin
85
+ date = Time.zone.parse("#{birth_date}-01-01")
86
+ rescue
87
+ nil
88
+ end
89
+ end
90
+ end
91
+ self.date_of_birth = date
92
+ end
93
+
94
+ def set_date_of_death
95
+ return if death_date.blank?
96
+ begin
97
+ date = Time.zone.parse("#{death_date}")
98
+ rescue ArgumentError
99
+ begin
100
+ date = Time.zone.parse("#{death_date}-01")
101
+ rescue ArgumentError
102
+ begin
103
+ date = Time.zone.parse("#{death_date}-01-01")
104
+ rescue
105
+ nil
106
+ end
107
+ end
108
+ end
109
+
110
+ self.date_of_death = date
111
+ end
112
+
113
+ def check_birth_date
114
+ if date_of_birth.present? and date_of_death.present?
115
+ if date_of_birth > date_of_death
116
+ errors.add(:birth_date)
117
+ errors.add(:death_date)
118
+ end
119
+ end
120
+ end
121
+
122
+ #def full_name_generate
123
+ # # TODO: 日本人以外は?
124
+ # name = []
125
+ # name << self.last_name.to_s.strip
126
+ # name << self.middle_name.to_s.strip unless self.middle_name.blank?
127
+ # name << self.first_name.to_s.strip
128
+ # name << self.corporate_name.to_s.strip
129
+ # name.join(" ").strip
130
+ #end
131
+
132
+ def full_name_without_space
133
+ full_name.gsub(/\s/, "")
134
+ # # TODO: 日本人以外は?
135
+ # name = []
136
+ # name << self.last_name.to_s.strip
137
+ # name << self.middle_name.to_s.strip
138
+ # name << self.first_name.to_s.strip
139
+ # name << self.corporate_name.to_s.strip
140
+ # name.join("").strip
141
+ end
142
+
143
+ def full_name_transcription_without_space
144
+ full_name_transcription.to_s.gsub(/\s/, "")
145
+ end
146
+
147
+ def full_name_alternative_without_space
148
+ full_name_alternative.to_s.gsub(/\s/, "")
149
+ end
150
+
151
+ def name
152
+ name = []
153
+ name << full_name.to_s.strip
154
+ name << full_name_transcription.to_s.strip
155
+ name << full_name_alternative.to_s.strip
156
+ #name << full_name_without_space
157
+ #name << full_name_transcription_without_space
158
+ #name << full_name_alternative_without_space
159
+ #name << full_name.wakati rescue nil
160
+ #name << full_name_transcription.wakati rescue nil
161
+ #name << full_name_alternative.wakati rescue nil
162
+ name
163
+ end
164
+
165
+ def date
166
+ if date_of_birth
167
+ if date_of_death
168
+ "#{date_of_birth} - #{date_of_death}"
169
+ else
170
+ "#{date_of_birth} -"
171
+ end
172
+ end
173
+ end
174
+
175
+ def creator?(resource)
176
+ resource.creators.include?(self)
177
+ end
178
+
179
+ def publisher?(resource)
180
+ resource.publishers.include?(self)
181
+ end
182
+
183
+ def check_required_role(user)
184
+ return true if self.user.blank?
185
+ return true if self.user.required_role.name == 'Guest'
186
+ return true if user == self.user
187
+ return true if user.has_role?(self.user.required_role.name)
188
+ false
189
+ rescue NoMethodError
190
+ false
191
+ end
192
+
193
+ def created(work)
194
+ creates.where(:work_id => work.id).first
195
+ end
196
+
197
+ def realized(expression)
198
+ realizes.where(:expression_id => expression.id).first
199
+ end
200
+
201
+ def produced(manifestation)
202
+ produces.where(:manifestation_id => manifestation.id).first
203
+ end
204
+
205
+ def owned(item)
206
+ owns.where(:item_id => item.id)
207
+ end
208
+
209
+ def self.import_patrons(patron_lists)
210
+ list = []
211
+ patron_lists.each do |patron_list|
212
+ patron = Patron.where(:full_name => patron_list[:full_name]).first
213
+ unless patron
214
+ patron = Patron.new(
215
+ :full_name => patron_list[:full_name],
216
+ :full_name_transcription => patron_list[:full_name_transcription],
217
+ :language_id => 1
218
+ )
219
+ patron.required_role = Role.where(:name => 'Guest').first
220
+ patron.save
221
+ end
222
+ list << patron
223
+ end
224
+ list
225
+ end
226
+
227
+ def patrons
228
+ self.original_patrons + self.derived_patrons
229
+ end
230
+
231
+ def self.create_with_user(params, user)
232
+ patron = Patron.new(params)
233
+ #patron.full_name = user.username if patron.full_name.blank?
234
+ patron.email = user.email
235
+ patron.required_role = Role.find(:first, :conditions => ['name=?', "Librarian"]) rescue nil
236
+ patron.language = Language.find(:first, :conditions => ['iso_639_1=?', user.locale]) rescue nil
237
+ patron
238
+ end
239
+
240
+ def change_note
241
+ data = Patron.find(self.id).note rescue nil
242
+ unless data == self.note
243
+ self.note_update_at = Time.zone.now
244
+ if User.current_user.nil?
245
+ #TODO
246
+ self.note_update_by = "SYSTEM"
247
+ self.note_update_library = "SYSTEM"
248
+ else
249
+ self.note_update_by = User.current_user.patron.full_name
250
+ self.note_update_library = Library.find(User.current_user.library_id).display_name
251
+ end
252
+ end
253
+ end
254
+
255
+ private
256
+ def check_duplicate_user
257
+ return if SystemConfiguration.get("patron.check_duplicate_user").nil? || SystemConfiguration.get("patron.check_duplicate_user") == false
258
+ chash = {}
259
+ #TODO
260
+ #chash[:full_name_transcription] = self.full_name_transcription.gsub(/\s| /, "") unless self.full_name_transcription.blank?
261
+ chash[:full_name_transcription] = self.full_name_transcription.strip unless self.full_name_transcription.blank?
262
+ chash[:birth_date] = self.birth_date unless self.birth_date.blank?
263
+ chash[:telephone_number_1] = self.telephone_number_1 unless self.telephone_number_1.blank?
264
+
265
+ return false if chash.empty?
266
+
267
+ p = Patron.find(:all, :conditions => chash)
268
+
269
+ p.delete_if {|p| p.id == self.id} if p
270
+
271
+ if p && p.size > 0
272
+ errors.add_to_base(I18n.t('patron.duplicate_user'))
273
+ end
274
+ #logger.info errors.inspect
275
+ end
276
+
277
+
278
+ end
279
+
280
+ # == Schema Information
281
+ #
282
+ # Table name: patrons
283
+ #
284
+ # id :integer not null, primary key
285
+ # user_id :integer
286
+ # last_name :string(255)
287
+ # middle_name :string(255)
288
+ # first_name :string(255)
289
+ # last_name_transcription :string(255)
290
+ # middle_name_transcription :string(255)
291
+ # first_name_transcription :string(255)
292
+ # corporate_name :string(255)
293
+ # corporate_name_transcription :string(255)
294
+ # full_name :string(255)
295
+ # full_name_transcription :text
296
+ # full_name_alternative :text
297
+ # created_at :datetime
298
+ # updated_at :datetime
299
+ # deleted_at :datetime
300
+ # zip_code_1 :string(255)
301
+ # zip_code_2 :string(255)
302
+ # address_1 :text
303
+ # address_2 :text
304
+ # address_1_note :text
305
+ # address_2_note :text
306
+ # telephone_number_1 :string(255)
307
+ # telephone_number_2 :string(255)
308
+ # fax_number_1 :string(255)
309
+ # fax_number_2 :string(255)
310
+ # other_designation :text
311
+ # place :text
312
+ # street :text
313
+ # locality :text
314
+ # region :text
315
+ # date_of_birth :datetime
316
+ # date_of_death :datetime
317
+ # language_id :integer default(1), not null
318
+ # country_id :integer default(1), not null
319
+ # patron_type_id :integer default(1), not null
320
+ # lock_version :integer default(0), not null
321
+ # note :text
322
+ # creates_count :integer default(0), not null
323
+ # realizes_count :integer default(0), not null
324
+ # produces_count :integer default(0), not null
325
+ # owns_count :integer default(0), not null
326
+ # required_role_id :integer default(1), not null
327
+ # required_score :integer default(0), not null
328
+ # state :string(255)
329
+ # email :text
330
+ # url :text
331
+ # full_name_alternative_transcription :text
332
+ # title :string(255)
333
+ # birth_date :string(255)
334
+ # death_date :string(255)
335
+ # address_1_key :binary
336
+ # address_1_iv :binary
337
+ # address_2_key :binary
338
+ # address_2_iv :binary
339
+ # telephone_number_key :binary
340
+ # telephone_number_iv :binary
341
+ #
342
+
@@ -0,0 +1,47 @@
1
+ class Role < ActiveRecord::Base
2
+ include MasterModel
3
+ default_scope :order => "roles.position"
4
+ has_many :user_has_roles
5
+ has_many :users, :through => :user_has_roles
6
+ after_save :clear_all_cache
7
+ after_destroy :clear_all_cache
8
+
9
+ def self.librarian_role_ids
10
+ Role.where(:name => ['Administrator', 'Librarian']).select('id').inject([]) {|a, b| a << b.id}
11
+ end
12
+
13
+ def localized_name
14
+ display_name.localize
15
+ end
16
+
17
+ def self.all_cache
18
+ if Rails.env == 'production'
19
+ Rails.cache.fetch('role_all'){Role.select(:name).all}
20
+ else
21
+ Role.select(:name)
22
+ end
23
+ end
24
+
25
+ def clear_all_cache
26
+ Rails.cache.delete('role_all')
27
+ end
28
+
29
+ def self.default_role
30
+ Rails.cache.fetch('default_role'){Role.find('Guest')}
31
+ end
32
+ end
33
+
34
+ # == Schema Information
35
+ #
36
+ # Table name: roles
37
+ #
38
+ # id :integer not null, primary key
39
+ # name :string(255) not null
40
+ # display_name :string(255)
41
+ # note :text
42
+ # created_at :datetime
43
+ # updated_at :datetime
44
+ # score :integer default(0), not null
45
+ # position :integer
46
+ #
47
+
@@ -0,0 +1,83 @@
1
+ class Shelf < ActiveRecord::Base
2
+ include MasterModel
3
+ default_scope :order => 'shelves.position'
4
+ scope :real, where('library_id != 1')
5
+ belongs_to :library, :validate => true
6
+ has_many :items, :include => [:circulation_status]
7
+ has_many :picture_files, :as => :picture_attachable, :dependent => :destroy
8
+ has_many :statistics
9
+
10
+ validates_associated :library
11
+ validates_presence_of :library, :open_access
12
+ validates_uniqueness_of :display_name, :scope => :library_id
13
+
14
+ acts_as_list :scope => :library
15
+
16
+ def self.per_page
17
+ 10
18
+ end
19
+
20
+ def web_shelf?
21
+ return true if self.id == 1
22
+ false
23
+ end
24
+
25
+ def self.web
26
+ Shelf.find(1)
27
+ end
28
+
29
+ def first?
30
+ # 必ずposition順に並んでいる
31
+ return true if library.shelves.first.position == position
32
+ false
33
+ end
34
+
35
+ def localized_display_name
36
+ display_name.localize
37
+ end
38
+
39
+ def destroy?
40
+ return false if Item.where(:shelf_id => self.id).first
41
+ return true
42
+ end
43
+
44
+ def open?
45
+ return true if self.open_access == 0
46
+ return false
47
+ end
48
+
49
+ def self.get_closing_report(item)
50
+ logger.error "closing report"
51
+ begin
52
+ report = ThinReports::Report.new :layout => "#{Rails.root.to_s}/app/views/shelves/close_shelf"
53
+ report.start_new_page
54
+ report.page.item(:export_date).value(Time.now)
55
+ report.page.item(:title).value(item.manifestation.original_title)
56
+ report.page.item(:call_number).value(item.call_number)
57
+ report.page.item(:library).value(item.shelf.library.display_name.localize)
58
+ report.page.item(:shelf).value(item.shelf.display_name.localize)
59
+ logger.error "created report: #{Time.now}"
60
+ return report.generate
61
+ rescue Exception => e
62
+ logger.error "failed #{e}"
63
+ return false
64
+ end
65
+ end
66
+ end
67
+
68
+ # == Schema Information
69
+ #
70
+ # Table name: shelves
71
+ #
72
+ # id :integer not null, primary key
73
+ # name :string(255) not null
74
+ # display_name :text
75
+ # note :text
76
+ # library_id :integer default(1), not null
77
+ # items_count :integer default(0), not null
78
+ # position :integer
79
+ # created_at :datetime
80
+ # updated_at :datetime
81
+ # deleted_at :datetime
82
+ #
83
+