enju_library 0.3.3 → 0.3.4

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 (86) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/accepts_controller.rb +1 -1
  3. data/app/controllers/bookstores_controller.rb +1 -1
  4. data/app/controllers/budget_types_controller.rb +1 -1
  5. data/app/controllers/libraries_controller.rb +1 -1
  6. data/app/controllers/library_groups_controller.rb +1 -1
  7. data/app/controllers/request_status_types_controller.rb +1 -1
  8. data/app/controllers/request_types_controller.rb +1 -1
  9. data/app/controllers/search_engines_controller.rb +1 -1
  10. data/app/controllers/shelves_controller.rb +2 -2
  11. data/app/controllers/subscribes_controller.rb +1 -1
  12. data/app/controllers/user_export_files_controller.rb +1 -1
  13. data/app/controllers/user_groups_controller.rb +1 -1
  14. data/app/controllers/user_import_files_controller.rb +1 -1
  15. data/app/controllers/withdraws_controller.rb +1 -1
  16. data/app/jobs/user_export_file_job.rb +1 -1
  17. data/app/jobs/user_import_file_job.rb +1 -1
  18. data/app/models/accept.rb +1 -1
  19. data/app/models/basket.rb +1 -1
  20. data/app/models/bookstore.rb +1 -1
  21. data/app/models/budget_type.rb +1 -1
  22. data/app/models/color.rb +1 -1
  23. data/app/models/library.rb +1 -1
  24. data/app/models/library_group.rb +1 -1
  25. data/app/models/request_status_type.rb +1 -1
  26. data/app/models/request_type.rb +1 -1
  27. data/app/models/search_engine.rb +1 -1
  28. data/app/models/shelf.rb +4 -2
  29. data/app/models/subscribe.rb +1 -1
  30. data/app/models/subscription.rb +1 -1
  31. data/app/models/user_export_file.rb +1 -1
  32. data/app/models/user_export_file_transition.rb +1 -1
  33. data/app/models/user_group.rb +3 -3
  34. data/app/models/user_import_file.rb +2 -2
  35. data/app/models/user_import_file_transition.rb +1 -1
  36. data/app/models/user_import_result.rb +1 -1
  37. data/app/models/withdraw.rb +1 -1
  38. data/app/views/libraries/_map.html+phone.erb +1 -1
  39. data/app/views/libraries/_map.html.erb +1 -1
  40. data/lib/enju_library/version.rb +1 -1
  41. data/lib/generators/enju_library/setup/templates/db/fixtures/user_groups.yml +6 -0
  42. data/lib/tasks/enju_library_tasks.rake +2 -0
  43. data/spec/controllers/budget_types_controller_spec.rb +2 -2
  44. data/spec/dummy/app/jobs/application_job.rb +7 -0
  45. data/spec/dummy/app/models/application_record.rb +3 -0
  46. data/spec/dummy/app/models/user.rb +2 -1
  47. data/spec/dummy/db/migrate/032_create_checkins.rb +3 -6
  48. data/spec/dummy/db/migrate/033_create_checkouts.rb +5 -10
  49. data/spec/dummy/db/migrate/035_create_reserves.rb +4 -9
  50. data/spec/dummy/db/migrate/121_create_checked_items.rb +3 -4
  51. data/spec/dummy/db/migrate/129_create_item_has_use_restrictions.rb +2 -4
  52. data/spec/dummy/db/migrate/20081030023518_create_user_group_has_checkout_types.rb +2 -4
  53. data/spec/dummy/db/migrate/20081030023615_create_carrier_type_has_checkout_types.rb +2 -3
  54. data/spec/dummy/db/migrate/20081212075554_create_checkout_stat_has_manifestations.rb +2 -2
  55. data/spec/dummy/db/migrate/20081215094955_create_checkout_stat_has_users.rb +2 -4
  56. data/spec/dummy/db/migrate/20081216190517_create_reserve_stat_has_manifestations.rb +2 -2
  57. data/spec/dummy/db/migrate/20081220034117_create_reserve_stat_has_users.rb +2 -4
  58. data/spec/dummy/db/migrate/20090831220301_create_lending_policies.rb +2 -2
  59. data/spec/dummy/db/migrate/20100606065209_create_user_has_roles.rb +2 -4
  60. data/spec/dummy/db/migrate/20110627122938_add_number_of_day_to_notify_overdue_to_user_group.rb +2 -2
  61. data/spec/dummy/db/migrate/20120424103932_add_librarian_id_to_checked_item.rb +1 -1
  62. data/spec/dummy/db/migrate/20140122054321_create_profiles.rb +4 -5
  63. data/spec/dummy/db/migrate/20140810061942_add_user_id_to_user_checkout_stat.rb +4 -8
  64. data/spec/dummy/db/migrate/20141014065831_add_shelf_id_to_checkout.rb +1 -2
  65. data/spec/dummy/db/migrate/20141020120523_add_library_id_to_checkout.rb +1 -2
  66. data/spec/dummy/db/migrate/20150106001709_create_demands.rb +3 -6
  67. data/spec/dummy/db/migrate/20150421023923_create_identities.rb +1 -2
  68. data/spec/dummy/db/migrate/20180107161035_add_constraints_to_most_recent_for_reserve_transitions.rb +13 -0
  69. data/spec/dummy/db/migrate/20180107161311_add_constraints_to_most_recent_for_agent_import_file_transitions.rb +13 -0
  70. data/spec/dummy/db/migrate/20180107161331_add_constraints_to_most_recent_for_resource_import_file_transitions.rb +13 -0
  71. data/spec/dummy/db/migrate/20180107161347_add_constraints_to_most_recent_for_resource_export_file_transitions.rb +13 -0
  72. data/spec/dummy/db/migrate/20180107161410_add_constraints_to_most_recent_for_import_request_transitions.rb +13 -0
  73. data/spec/dummy/db/migrate/20180107161951_add_constraints_to_most_recent_for_user_checkout_stat_transitions.rb +13 -0
  74. data/spec/dummy/db/migrate/20180107162009_add_constraints_to_most_recent_for_user_reserve_stat_transitions.rb +13 -0
  75. data/spec/dummy/db/migrate/20180107162029_add_constraints_to_most_recent_for_manifestation_checkout_stat_transitions.rb +13 -0
  76. data/spec/dummy/db/migrate/20180107162048_add_constraints_to_most_recent_for_manifestation_reserve_stat_transitions.rb +13 -0
  77. data/spec/dummy/db/schema.rb +29 -16
  78. data/spec/fixtures/items.yml +1 -1
  79. data/spec/fixtures/reserve_transitions.yml +15 -0
  80. data/spec/fixtures/user_groups.yml +2 -2
  81. data/spec/models/user_group_spec.rb +2 -2
  82. metadata +421 -370
  83. data/app/views/libraries/_map.html+phone.slim +0 -4
  84. data/lib/generators/enju_library/setup/templates/db/fixtures/shelves.yml +0 -15
  85. data/spec/libraries_spec.rb +0 -46
  86. data/spec/shelves_spec.rb +0 -46
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 518d6386e03d122a166917fc15a446fd49a9fbf2651c462b145750ddc67f848b
4
- data.tar.gz: 79d27b3572eb819d9ded99e22b7ead5c44c02c7b9e6d4ba2caaec5b151da6170
3
+ metadata.gz: 7fb21f17b1dd4ad3e311123992f5359ff191470046c394268e51376453ef6995
4
+ data.tar.gz: 22a9b2ed2af70d276aad8323e53782f22f5a8794cd4b632c4043e43a5b19b4e3
5
5
  SHA512:
6
- metadata.gz: e1f11e2a73dae41c407941907c3c367150125f067ec7f7dea9a06055ad6c3aa769091535af07ef73dfa6677a3f1a87a22b6abec8aafa091d4a1e63afa3d9aa92
7
- data.tar.gz: 70fc2466822926ce04dfb8cca850ddc877c4b72e2def06f372db94de6cdb0fa97e71c1df410846a943a6b55063b09c3b59664a4482e755cbd12a323a79c5dcf9
6
+ metadata.gz: 392a2f02f6860a7f7da0a1ff67d4a6d276748385c4763bcd1bd1001fef9967add797390c491098974422cc8b3d47d86f87092fa05f5ad0b63730d42131e7a242
7
+ data.tar.gz: c22d984693895223120424adad3231c84ce959bd6f88a3196e9398134b04295ecd1ab42343de0f8339759685d589a8e3cc7c65776bf8099d50e414b5e12bc706
@@ -99,7 +99,7 @@ class AcceptsController < ApplicationController
99
99
  # PUT /accepts/1.json
100
100
  def update
101
101
  respond_to do |format|
102
- if @accept.update_attributes(accept_params)
102
+ if @accept.update(accept_params)
103
103
  format.html { redirect_to @accept, notice: t('controller.successfully_updated', model: t('activerecord.models.accept')) }
104
104
  format.json { head :no_content }
105
105
  else
@@ -62,7 +62,7 @@ class BookstoresController < ApplicationController
62
62
  end
63
63
 
64
64
  respond_to do |format|
65
- if @bookstore.update_attributes(bookstore_params)
65
+ if @bookstore.update(bookstore_params)
66
66
  format.html { redirect_to @bookstore, notice: t('controller.successfully_updated', model: t('activerecord.models.bookstore')) }
67
67
  format.json { head :no_content }
68
68
  else
@@ -62,7 +62,7 @@ class BudgetTypesController < ApplicationController
62
62
  end
63
63
 
64
64
  respond_to do |format|
65
- if @budget_type.update_attributes(budget_type_params)
65
+ if @budget_type.update(budget_type_params)
66
66
  format.html { redirect_to @budget_type, notice: t('controller.successfully_updated', model: t('activerecord.models.budget_type')) }
67
67
  format.json { head :no_content }
68
68
  else
@@ -94,7 +94,7 @@ class LibrariesController < ApplicationController
94
94
  end
95
95
 
96
96
  respond_to do |format|
97
- if @library.update_attributes(library_params)
97
+ if @library.update(library_params)
98
98
  format.html { redirect_to @library, notice: t('controller.successfully_updated', model: t('activerecord.models.library')) }
99
99
  format.json { head :no_content }
100
100
  else
@@ -44,7 +44,7 @@ class LibraryGroupsController < ApplicationController
44
44
  # PUT /library_groups/1.json
45
45
  def update
46
46
  respond_to do |format|
47
- if @library_group.update_attributes(library_group_params)
47
+ if @library_group.update(library_group_params)
48
48
  if @library_group.delete_header_logo == '1'
49
49
  @library_group.header_logo.destroy
50
50
  end
@@ -62,7 +62,7 @@ class RequestStatusTypesController < ApplicationController
62
62
  end
63
63
 
64
64
  respond_to do |format|
65
- if @request_status_type.update_attributes(request_status_type_params)
65
+ if @request_status_type.update(request_status_type_params)
66
66
  format.html { redirect_to @request_status_type, notice: t('controller.successfully_updated', model: t('activerecord.models.request_status_type')) }
67
67
  format.json { head :no_content }
68
68
  else
@@ -62,7 +62,7 @@ class RequestTypesController < ApplicationController
62
62
  end
63
63
 
64
64
  respond_to do |format|
65
- if @request_type.update_attributes(request_type_params)
65
+ if @request_type.update(request_type_params)
66
66
  format.html { redirect_to @request_type, notice: t('controller.successfully_updated', model: t('activerecord.models.request_type')) }
67
67
  format.json { head :no_content }
68
68
  else
@@ -62,7 +62,7 @@ class SearchEnginesController < ApplicationController
62
62
  end
63
63
 
64
64
  respond_to do |format|
65
- if @search_engine.update_attributes(search_engine_params)
65
+ if @search_engine.update(search_engine_params)
66
66
  format.html { redirect_to @search_engine, notice: t('controller.successfully_updated', model: t('activerecord.models.search_engine')) }
67
67
  format.json { head :no_content }
68
68
  else
@@ -16,7 +16,7 @@ class ShelvesController < ApplicationController
16
16
  render partial: 'select_form'
17
17
  return
18
18
  else
19
- sort = {sort_by: 'name', order: 'asc'}
19
+ sort = {sort_by: 'shelf_name', order: 'asc'}
20
20
  # case params[:sort_by]
21
21
  # when 'name'
22
22
  # sort[:sort_by] = 'name'
@@ -114,7 +114,7 @@ class ShelvesController < ApplicationController
114
114
  end
115
115
 
116
116
  respond_to do |format|
117
- if @shelf.update_attributes(shelf_params)
117
+ if @shelf.update(shelf_params)
118
118
  format.html { redirect_to @shelf, notice: t('controller.successfully_updated', model: t('activerecord.models.shelf')) }
119
119
  format.json { head :no_content }
120
120
  else
@@ -60,7 +60,7 @@ class SubscribesController < ApplicationController
60
60
  # PUT /subscribes/1.json
61
61
  def update
62
62
  respond_to do |format|
63
- if @subscribe.update_attributes(subscribe_params)
63
+ if @subscribe.update(subscribe_params)
64
64
  format.html { redirect_to @subscribe, notice: t('controller.successfully_updated', model: t('activerecord.models.subscribe')) }
65
65
  format.json { head :no_content }
66
66
  else
@@ -76,7 +76,7 @@ class UserExportFilesController < ApplicationController
76
76
  # PUT /user_export_files/1.json
77
77
  def update
78
78
  respond_to do |format|
79
- if @user_export_file.update_attributes(user_export_file_params)
79
+ if @user_export_file.update(user_export_file_params)
80
80
  if @user_export_file.mode == 'export'
81
81
  UserExportFileJob.perform_later(@user_export_file)
82
82
  end
@@ -63,7 +63,7 @@ class UserGroupsController < ApplicationController
63
63
  end
64
64
 
65
65
  respond_to do |format|
66
- if @user_group.update_attributes(user_group_params)
66
+ if @user_group.update(user_group_params)
67
67
  format.html { redirect_to @user_group, notice: t('controller.successfully_updated', model: t('activerecord.models.user_group')) }
68
68
  format.json { head :no_content }
69
69
  else
@@ -80,7 +80,7 @@ class UserImportFilesController < ApplicationController
80
80
  # PUT /user_import_files/1.json
81
81
  def update
82
82
  respond_to do |format|
83
- if @user_import_file.update_attributes(user_import_file_params)
83
+ if @user_import_file.update(user_import_file_params)
84
84
  if @user_import_file.mode == 'import'
85
85
  UserImportFileJob.perform_later(@user_import_file)
86
86
  end
@@ -100,7 +100,7 @@ class WithdrawsController < ApplicationController
100
100
  # PUT /withdraws/1.json
101
101
  def update
102
102
  respond_to do |format|
103
- if @withdraw.update_attributes(withdraw_params)
103
+ if @withdraw.update(withdraw_params)
104
104
  format.html { redirect_to @withdraw, notice: t('controller.successfully_updated', model: t('activerecord.models.withdraw')) }
105
105
  format.json { head :no_content }
106
106
  else
@@ -1,4 +1,4 @@
1
- class UserExportFileJob < ActiveJob::Base
1
+ class UserExportFileJob < ApplicationJob
2
2
  queue_as :enju_leaf
3
3
 
4
4
  def perform(user_export_file)
@@ -1,4 +1,4 @@
1
- class UserImportFileJob < ActiveJob::Base
1
+ class UserImportFileJob < ApplicationJob
2
2
  queue_as :enju_leaf
3
3
 
4
4
  def perform(user_import_file)
@@ -1,4 +1,4 @@
1
- class Accept < ActiveRecord::Base
1
+ class Accept < ApplicationRecord
2
2
  default_scope { order('accepts.id DESC') }
3
3
  belongs_to :basket
4
4
  belongs_to :item, touch: true
@@ -1,4 +1,4 @@
1
- class Basket < ActiveRecord::Base
1
+ class Basket < ApplicationRecord
2
2
  default_scope { order('baskets.id DESC') }
3
3
  scope :will_expire, lambda {|date| where('created_at < ?', date)}
4
4
  belongs_to :user, validate: true
@@ -1,4 +1,4 @@
1
- class Bookstore < ActiveRecord::Base
1
+ class Bookstore < ApplicationRecord
2
2
  default_scope { order('bookstores.position') }
3
3
  has_many :items
4
4
 
@@ -1,4 +1,4 @@
1
- class BudgetType < ActiveRecord::Base
1
+ class BudgetType < ApplicationRecord
2
2
  include MasterModel
3
3
  validates :name, presence: true, format: { with: /\A[0-9A-Za-z][0-9A-Za-z_\-\s,]*[0-9a-z]\Z/ }
4
4
  has_many :items
@@ -1,4 +1,4 @@
1
- class Color < ActiveRecord::Base
1
+ class Color < ApplicationRecord
2
2
  #attr_accessible :code, :property
3
3
 
4
4
  belongs_to :library_group
@@ -1,4 +1,4 @@
1
- class Library < ActiveRecord::Base
1
+ class Library < ApplicationRecord
2
2
  include MasterModel
3
3
  default_scope { order('libraries.position') }
4
4
  scope :real, -> { where('id != 1') }
@@ -1,4 +1,4 @@
1
- class LibraryGroup < ActiveRecord::Base
1
+ class LibraryGroup < ApplicationRecord
2
2
  #include Singleton
3
3
  include MasterModel
4
4
 
@@ -1,4 +1,4 @@
1
- class RequestStatusType < ActiveRecord::Base
1
+ class RequestStatusType < ApplicationRecord
2
2
  include MasterModel
3
3
  validates :name, presence: true, format: { with: /\A[0-9A-Za-z][0-9A-Za-z_\-\s,]*[0-9a-z]\Z/ }
4
4
  has_many :reserves
@@ -1,4 +1,4 @@
1
- class RequestType < ActiveRecord::Base
1
+ class RequestType < ApplicationRecord
2
2
  include MasterModel
3
3
  validates :name, presence: true, format: { with: /\A[0-9A-Za-z][0-9A-Za-z_\-\s,]*[0-9a-z]\Z/ }
4
4
 
@@ -1,4 +1,4 @@
1
- class SearchEngine < ActiveRecord::Base
1
+ class SearchEngine < ApplicationRecord
2
2
  acts_as_list
3
3
 
4
4
  validates :name, presence: true
@@ -1,4 +1,4 @@
1
- class Shelf < ActiveRecord::Base
1
+ class Shelf < ApplicationRecord
2
2
  include MasterModel
3
3
  scope :real, -> { where('library_id != 1') }
4
4
  belongs_to :library, validate: true
@@ -14,7 +14,9 @@ class Shelf < ActiveRecord::Base
14
14
  acts_as_list scope: :library
15
15
 
16
16
  searchable do
17
- string :name
17
+ string :shelf_name do
18
+ name
19
+ end
18
20
  string :library do
19
21
  library.name
20
22
  end
@@ -1,4 +1,4 @@
1
- class Subscribe < ActiveRecord::Base
1
+ class Subscribe < ApplicationRecord
2
2
  belongs_to :subscription, counter_cache: true, validate: true
3
3
  belongs_to :work, class_name: 'Manifestation', validate: true
4
4
 
@@ -1,4 +1,4 @@
1
- class Subscription < ActiveRecord::Base
1
+ class Subscription < ApplicationRecord
2
2
  has_many :subscribes, dependent: :destroy
3
3
  has_many :works, through: :subscribes
4
4
  belongs_to :user, validate: true
@@ -1,4 +1,4 @@
1
- class UserExportFile < ActiveRecord::Base
1
+ class UserExportFile < ApplicationRecord
2
2
  include Statesman::Adapters::ActiveRecordQueries
3
3
  include ExportFile
4
4
 
@@ -1,4 +1,4 @@
1
- class UserExportFileTransition < ActiveRecord::Base
1
+ class UserExportFileTransition < ApplicationRecord
2
2
  include Statesman::Adapters::ActiveRecordTransition
3
3
 
4
4
 
@@ -1,4 +1,4 @@
1
- class UserGroup < ActiveRecord::Base
1
+ class UserGroup < ApplicationRecord
2
2
  include MasterModel
3
3
  has_many :profiles
4
4
 
@@ -23,7 +23,7 @@ end
23
23
  # deleted_at :datetime
24
24
  # valid_period_for_new_user :integer default(0), not null
25
25
  # expired_at :datetime
26
- # number_of_day_to_notify_overdue :integer default(1), not null
27
- # number_of_day_to_notify_due_date :integer default(7), not null
26
+ # number_of_day_to_notify_overdue :integer default(7), not null
27
+ # number_of_day_to_notify_due_date :integer default(3), not null
28
28
  # number_of_time_to_notify_overdue :integer default(3), not null
29
29
  #
@@ -1,4 +1,4 @@
1
- class UserImportFile < ActiveRecord::Base
1
+ class UserImportFile < ApplicationRecord
2
2
  include Statesman::Adapters::ActiveRecordQueries
3
3
  include ImportFile
4
4
  default_scope {order('user_import_files.id DESC')}
@@ -192,7 +192,7 @@ class UserImportFile < ActiveRecord::Base
192
192
  rows.each do |row|
193
193
  row_num += 1
194
194
  username = row['username'].to_s.strip
195
- remove_user = User.where(username: username).first
195
+ remove_user = User.find_by(username: username)
196
196
  if remove_user.try(:deletable_by?, user)
197
197
  UserImportFile.transaction do
198
198
  remove_user.destroy
@@ -1,4 +1,4 @@
1
- class UserImportFileTransition < ActiveRecord::Base
1
+ class UserImportFileTransition < ApplicationRecord
2
2
  include Statesman::Adapters::ActiveRecordTransition
3
3
 
4
4
 
@@ -1,4 +1,4 @@
1
- class UserImportResult < ActiveRecord::Base
1
+ class UserImportResult < ApplicationRecord
2
2
  scope :file_id, proc{ |file_id| where(user_import_file_id: file_id) }
3
3
  scope :failed, -> { where(user_id: nil) }
4
4
 
@@ -1,4 +1,4 @@
1
- class Withdraw < ActiveRecord::Base
1
+ class Withdraw < ApplicationRecord
2
2
  belongs_to :basket
3
3
  belongs_to :item, touch: true
4
4
  belongs_to :librarian, class_name: 'User'
@@ -1,4 +1,4 @@
1
- <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
1
+ <script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>
2
2
  <script type="text/javascript">
3
3
  google.maps.event.addDomListener(window, 'load', function() {
4
4
  var latlng = new google.maps.LatLng(<%= library.latitude %>, <%= library.longitude %>);
@@ -1,4 +1,4 @@
1
- <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
1
+ <script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>
2
2
  <script type="text/javascript">
3
3
  google.maps.event.addDomListener(window, 'load', function() {
4
4
  var latlng = new google.maps.LatLng(<%= library.latitude %>, <%= library.longitude %>);
@@ -1,3 +1,3 @@
1
1
  module EnjuLibrary
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
@@ -0,0 +1,6 @@
1
+ ---
2
+ user_group_00001:
3
+ name: "first_group"
4
+ display_name: "First group"
5
+ note: ""
6
+ position: 1
@@ -13,6 +13,8 @@ namespace :enju_library do
13
13
  next if basename == 'library_groups'
14
14
  ActiveRecord::FixtureSet.create_fixtures('db/fixtures/enju_library', basename)
15
15
  end
16
+ Shelf.create!(name: 'web', library: Library.find_by(name: 'web'))
17
+ Shelf.create!(name: 'first_shelf', library: Library.find_by(name: 'yours'))
16
18
  end
17
19
 
18
20
  desc "upgrade enju_library"
@@ -103,9 +103,9 @@ describe BudgetTypesController do
103
103
  budget_type = BudgetType.create! valid_attributes
104
104
  # Assuming there are no other budget_types in the database, this
105
105
  # specifies that the BudgetType created on the previous line
106
- # receives the :update_attributes message with whatever params are
106
+ # receives the :update message with whatever params are
107
107
  # submitted in the request.
108
- BudgetType.any_instance.should_receive(:update_attributes).with('note' => 'test')
108
+ BudgetType.any_instance.should_receive(:update).with('note' => 'test')
109
109
  put :update, params: { id: budget_type.id, budget_type: { note: 'test' } }
110
110
  end
111
111
 
@@ -0,0 +1,7 @@
1
+ class ApplicationJob < ActiveJob::Base
2
+ # Automatically retry jobs that encountered a deadlock
3
+ # retry_on ActiveRecord::Deadlocked
4
+
5
+ # Most jobs are safe to ignore if the underlying records are no longer available
6
+ # discard_on ActiveJob::DeserializationError
7
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ end
@@ -1,10 +1,11 @@
1
- class User < ActiveRecord::Base
1
+ class User < ApplicationRecord
2
2
  devise :database_authenticatable, #:registerable,
3
3
  :recoverable, :rememberable, :trackable, #, :validatable
4
4
  :lockable, lock_strategy: :none, unlock_strategy: :none
5
5
 
6
6
  include EnjuSeed::EnjuUser
7
7
  include EnjuCirculation::EnjuUser
8
+ has_one :profile, dependent: :nullify
8
9
  end
9
10
 
10
11
  Accept.include(EnjuCirculation::EnjuAccept)
@@ -1,14 +1,11 @@
1
1
  class CreateCheckins < ActiveRecord::Migration[4.2]
2
2
  def self.up
3
3
  create_table :checkins do |t|
4
- t.integer :item_id, null: false
5
- t.integer :librarian_id
6
- t.integer :basket_id
4
+ t.references :item, index: true, foreign_key: true, null: false
5
+ t.references :librarian, index: true
6
+ t.references :basket, index: true
7
7
  t.timestamps
8
8
  end
9
- add_index :checkins, :item_id
10
- add_index :checkins, :librarian_id
11
- add_index :checkins, :basket_id
12
9
  end
13
10
 
14
11
  def self.down
@@ -1,22 +1,17 @@
1
1
  class CreateCheckouts < ActiveRecord::Migration[4.2]
2
2
  def self.up
3
3
  create_table :checkouts do |t|
4
- t.integer :user_id
5
- t.integer :item_id, null: false
6
- t.integer :checkin_id
7
- t.integer :librarian_id
8
- t.integer :basket_id
4
+ t.references :user, index: true, foreign_key: true
5
+ t.references :item, index: true, foreign_key: true, null: false
6
+ t.references :checkin, index: true, foreign_key: true
7
+ t.references :librarian, index: true
8
+ t.references :basket, index: true
9
9
  t.datetime :due_date
10
10
  t.integer :checkout_renewal_count, default: 0, null: false
11
11
  t.integer :lock_version, default: 0, null: false
12
12
  t.timestamps
13
13
  end
14
- add_index :checkouts, :user_id
15
- add_index :checkouts, :item_id
16
- add_index :checkouts, :basket_id
17
14
  add_index :checkouts, [:item_id, :basket_id], unique: true
18
- add_index :checkouts, :librarian_id
19
- add_index :checkouts, :checkin_id
20
15
  end
21
16
 
22
17
  def self.down