effective_resources 1.17.0 → 1.18.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: 89ee5768e0e064df020dfd0da3110e601fa51dd100d10a909442279c5e85465e
4
- data.tar.gz: 03d67a2c0228472542671b781ba00a16fd3959e541adc4d1e9beeaf3e23d2b58
3
+ metadata.gz: e85d51e9a321bc50d365988828721b264bd2ef27476a9d3cb3650217f5b130e3
4
+ data.tar.gz: a98e8d5ba21daa4519e5167b7c19a07bc61d4a3fc21d1b297e67eb19f558dc3b
5
5
  SHA512:
6
- metadata.gz: 143e22c3e4df4f5937fefd00963d97e483e4d6355ad13367a3a1e64a74c0a32541cd5d2fe3100e728fa839e15ff32dc6f5c4b716ce69dd718b8d53b43a15b899
7
- data.tar.gz: 2dba5416763bec7476ffd586dbade4dd44fc21eb3112580c09b470eb5bf719a18116294e8f5c2afcb85e80d48a459d80a91734e27f68e342af6a9b7238c7b4da
6
+ metadata.gz: 4e8cf35a3218e404cb37510c2c3b0bfb966a73f85850cd5cd5f7aced1ea024dd505b07f1994d58b5ed2ad81c8ca1daf16898f9bd26c1d88f4fe57ce4c21e278d
7
+ data.tar.gz: c6fdf528e8a9f8ace078e51410483b0d4f8f4c2bddb367b0559ccc7965181d58668acad33db847c32484e3e215464390df7c01728fd4c8a8cd8064a76432a5bf
@@ -60,7 +60,9 @@ module Effective
60
60
  when ActiveRecord::StaleObjectError
61
61
  flash.now[:danger] = "#{flash.now[:danger]} <a href='#', class='alert-link' onclick='window.location.reload(true); return false;'>reload page and try again</a>"
62
62
  raise(ActiveRecord::Rollback) # This is a soft error, we want to display the flash message to user
63
- when Effective::ActionFailed, ActiveRecord::RecordInvalid, RuntimeError
63
+ when Effective::ActionFailed
64
+ # Nothing to do
65
+ when ActiveRecord::RecordInvalid, RuntimeError
64
66
  raise(ActiveRecord::Rollback) # This is a soft error, we want to display the flash message to user
65
67
  else
66
68
  raise(e) # This is a real error that should be sent to 500. Client should not see the message.
@@ -126,10 +126,13 @@ module Effective
126
126
  end
127
127
 
128
128
  def resource_layout
129
+ namespace = controller_path.include?('admin/') ? 'admin' : 'application'
130
+
129
131
  if defined?(Tenant)
130
- namespace = controller_path.include?('admin/') ? 'admin' : 'application'
131
- "#{Tenant.current}/#{namespace}"
132
+ return "#{Tenant.current}/#{namespace}"
132
133
  end
134
+
135
+ namespace
133
136
  end
134
137
 
135
138
  def resource_params_method_name
@@ -21,7 +21,7 @@ module EffectiveResources
21
21
 
22
22
  # Include acts_as_addressable concern and allow any ActiveRecord object to call it
23
23
  initializer 'effective_resources.active_record' do |app|
24
- ActiveSupport.on_load :active_record do
24
+ app.config.to_prepare do
25
25
  ActiveRecord::Base.extend(ActsAsArchived::Base)
26
26
  ActiveRecord::Base.extend(ActsAsEmailForm::Base)
27
27
  ActiveRecord::Base.extend(ActsAsTokened::Base)
@@ -38,7 +38,7 @@ module EffectiveResources
38
38
  end
39
39
 
40
40
  initializer 'effective_resources.cancancan' do |app|
41
- ActiveSupport.on_load :active_record do
41
+ app.config.to_prepare do
42
42
  if defined?(CanCan::Ability)
43
43
  CanCan::Ability.module_eval do
44
44
  CRUD_ACTIONS = [:index, :new, :create, :edit, :update, :show, :destroy]
@@ -64,8 +64,10 @@ module EffectiveResources
64
64
 
65
65
  # Register the flash_messages concern so that it can be called in ActionController
66
66
  initializer 'effective_resources.action_controller' do |app|
67
- ActiveSupport.on_load :action_controller do
68
- include(Effective::FlashMessages)
67
+ app.config.to_prepare do
68
+ ActiveSupport.on_load :action_controller do
69
+ include(Effective::FlashMessages)
70
+ end
69
71
  end
70
72
  end
71
73
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '1.17.0'.freeze
2
+ VERSION = '1.18.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.17.0
4
+ version: 1.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-17 00:00:00.000000000 Z
11
+ date: 2022-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails