Skip to content

Commit 61be71a

Browse files
authored
Merge pull request #13 from hoppergee/fix_view_helper
Fix view helper
2 parents 4f5d3ac + 587af88 commit 61be71a

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## [Unreleased]
22

3+
## [1.3.1] - 2021-10-10
4+
5+
- Make ViewHelper work in both controller and view
6+
37
## [1.3.0] - 2021-10-10
48

59
- Integrate with Rails default testing toolchain (Minitest + Capybara)

lib/multi_tenant_support/concern/controller_concern.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ module ControllerConcern
1010

1111
private
1212

13-
define_method(MultiTenantSupport.current_tenant_account_method) do
14-
instance_variable_get("@#{MultiTenantSupport.current_tenant_account_method}")
15-
end
16-
1713
def set_current_tenant_account
1814
tenant_account = find_current_tenant_account
1915
MultiTenantSupport::Current.tenant_account = tenant_account
@@ -31,8 +27,12 @@ def find_current_tenant_account
3127
end
3228

3329
module ViewHelper
34-
define_method(MultiTenantSupport.current_tenant_account_method) do
35-
instance_variable_get("@#{MultiTenantSupport.current_tenant_account_method}")
30+
extend ActiveSupport::Concern
31+
32+
included do
33+
define_method(MultiTenantSupport.current_tenant_account_method) do
34+
instance_variable_get("@#{MultiTenantSupport.current_tenant_account_method}")
35+
end
3636
end
3737
end
3838
end
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module MultiTenantSupport
2-
VERSION = '1.3.0'
2+
VERSION = '1.3.1'
33
end

0 commit comments

Comments
 (0)