better_record 0.8.6 → 0.9.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b50b47b58ce636f061cddb1dd365d34a01f900b580f4c6827756be8b12aea7ac
4
- data.tar.gz: 9c1f93c3c4904fc394a15aa2f82da32990494f402f2eb7ef76bebb7eeb417219
3
+ metadata.gz: e4cc9e274c86423900277570307e4fa93f8e7abbf408e0d81bf0ed7457a55827
4
+ data.tar.gz: ab258ed68779613a3012cba3ad2627bb9d7e0993b621512ff47addd76bbc2a6f
5
5
  SHA512:
6
- metadata.gz: 03b1852f0859a2642846eb021db66d6b43dd57c94562e391af80b4fe3db56d1ee79d5715987d0bcd834bc4f120f8bfdbc229355e5ce2ebf83f54186ff8072d53
7
- data.tar.gz: a3ce03f7ba87f590b0b14f4b8ca485c852fc3b0b6ab550537327a31d2bf4d984397bd3f0e8ecbe49d5f3e0918e6f683281ff0fa99ed569fe4f3b787d713631eb
6
+ metadata.gz: f1a09eda9ab509b521b5f582315fb61c03750efb983f71e8f7e7241e991c681d1bc958bad7f6c037f2d9d951428b47bdf15cdf5ed9b3c2f1a17bb7173ae644db
7
+ data.tar.gz: 0ac901cc4a8b83ce7fa79dee7ebed223ce4506d7e6021578c6178df3a0fe72c3d578dd722acf5e2e418afdec3b4758ca775f95eca27ddeda4cfa904b7b0b3815
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'active_support/concern'
4
4
  require 'active_support/number_helper'
5
+ require 'active_storage/engine'
5
6
 
6
7
  module BetterRecord
7
8
  module ModelConcerns
data/lib/better_record.rb CHANGED
@@ -36,6 +36,19 @@ module BetterRecord
36
36
 
37
37
  attr_accessor *ATTRIBUTE_METHODS
38
38
 
39
+ # ATTRIBUTE_METHODS.each do |method|
40
+ # if method.to_s =~ /_class/
41
+ # define_method method do
42
+ # val = instance_variable_get(:"@#{method}")
43
+ # val.is_a?(String) ? __send__(:"#{method}=", val.constantize) : val
44
+ # end
45
+ #
46
+ # define_method :"#{method}=" do |val|
47
+ # instance_variable_set(:"@#{method}", val)
48
+ # end
49
+ # end
50
+ # end
51
+
39
52
  private
40
53
  def attrs_hash
41
54
  @attrs ||= ATTRIBUTE_METHODS.map {|k| [k, true]}.to_h.with_indifferent_access.freeze
@@ -71,9 +84,3 @@ ActiveSupport.on_load(:active_record) do
71
84
  end
72
85
  end
73
86
  end
74
- # !centered[## [Men's Results](/assets/pdfs/2018-golf-international-results-male.pdf)--br--[![Mens Results](/assets/images/2018-golf-international-results-male.jpg)](/assets/pdfs/2018-golf-international-results-male.pdf)]
75
- # !centered[## [Women's Results](/assets/pdfs/2018-golf-international-results-female.pdf)--br--[![Womens Results](/assets/images/2018-golf-international-results-female.jpg)](/assets/pdfs/2018-golf-international-results-female.pdf)]
76
- # !centered[## [Team Results](/assets/pdfs/2018-golf-international-results-team.pdf)--br--[![Team Results](/assets/images/2018-golf-international-results-team)](/assets/pdfs/2018-golf-international-results-team.pdf)]
77
- #
78
- # !centered[## [Team Results](/assets/pdfs/2018-golf-international-results-summary.pdf)--br--[![Team Results](/assets/images/2018-golf-international-results-summary.jpg)](/assets/pdfs/2018-golf-international-results-summary.pdf)]
79
- # !centered[## [Individual Results](/assets/pdfs/2018-golf-international-results.pdf)--br--[![Team Results](/assets/images/2018-golf-international-results.jpg)](/assets/pdfs/2018-golf-international-results.pdf)]
@@ -7,5 +7,14 @@ module BetterRecord
7
7
  load f
8
8
  end
9
9
  end
10
+
11
+ initializer 'better_record.after_app' do |app|
12
+ app.config.after_initialize do
13
+ if BetterRecord.session_class.is_a?(String)
14
+ BetterRecord.session_class = BetterRecord.session_class.constantize
15
+ end
16
+ ActiveSupport.run_load_hooks(:better_record, BetterRecord)
17
+ end
18
+ end
10
19
  end
11
20
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BetterRecord
4
- VERSION = '0.8.6'
4
+ VERSION = '0.9.0'
5
5
  end
@@ -53,35 +53,42 @@ module BetterRecord
53
53
 
54
54
  # self.app_domain_name = 'default_app_name.com'
55
55
 
56
- # uncomment and set the session_class to enable gem handled session management
57
- # all other settings are optional
56
+ # Any code that should be run after the entire application is initialized
57
+ # should go in the following block
58
58
 
59
- # self.session_class = User
59
+ # ActiveSupport.on_load(:better_record) do
60
+ # uncomment and set the session_class to enable gem handled session management
61
+ # all other settings below are optional
60
62
 
61
- # OPTIONAL #
63
+ # self.session_class = User
62
64
 
63
- # set to true to use Auth headers instead of session cookies
64
- # self.use_bearer_token = true
65
+ # OPTIONAL #
65
66
 
66
- # self.after_login_path = Rails.application.routes.url_helpers.root_path
67
+ # set to true to use Auth headers instead of session cookies
67
68
 
68
- # self.session_column = :uuid
69
+ # self.use_bearer_token = true
69
70
 
70
- # self.session_data = ->(user) do
71
- # {
72
- # user_id: user.uuid,
73
- # first_access: user.first_login_time,
74
- # created_at: Time.now
75
- # }
76
- # end
71
+ # self.after_login_path = Rails.application.routes.url_helpers.root_path
72
+
73
+ # self.session_column = :uuid
74
+
75
+ # self.session_data = ->(user) do
76
+ # {
77
+ # user_id: user.uuid,
78
+ # first_access: user.first_login_time,
79
+ # created_at: Time.now
80
+ # }
81
+ # end
77
82
 
78
- # self.session_authenticate_method = :check_login
83
+ # self.session_authenticate_method = :check_login
79
84
 
80
- # self.certificate_session_class = Staff.includes(:user)
85
+ # self.certificate_session_class = Staff.includes(:user)
81
86
 
82
- # self.certificate_session_column = :cert_str
87
+ # self.certificate_session_column = :cert_str
88
+
89
+ # self.certificate_session_user_method = :user
90
+ # end
83
91
 
84
- # self.certificate_session_user_method = :user
85
92
  end
86
93
 
87
94
  # uncomment the following lines to set the keys needed for JWT token auth
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: better_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.6
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sampson Crowley