registrar-rails 0.2.0 → 0.3
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 +4 -4
- data/lib/registrar/rails/controller_extensions.rb +8 -16
- data/lib/registrar/rails/version.rb +1 -1
- data/test/dummy/log/test.log +48 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 17d8c356efd4f2b89e8e8f7dbb99898fc9b35250
|
|
4
|
+
data.tar.gz: 269c09b583a7cc2e5501394233ad063a480ddc60
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7051428a785342b9ddc3bf82c8dd73bfe1f7db7a2dbb87a792997dfca235ae70e8af1e52374f50f1d70b8bfe406ee9894febaa87f156fae4c36a47534e56eda6
|
|
7
|
+
data.tar.gz: 7e1e30da7a0012a8c5f82d8466967dd80c592485df256e93f1ca871a80e45d93c0531942a9d65eb04d7a16ce5ca9f7053c3cdd2a352f6af9cebe376fdd529075
|
|
@@ -18,14 +18,12 @@ module Registrar
|
|
|
18
18
|
|
|
19
19
|
def try_to_store_current_profile_uid
|
|
20
20
|
if registrar_profile = env[REGISTRAR_PROFILE_KEY]
|
|
21
|
-
|
|
21
|
+
session[CURRENT_PROFILE_UID] = registrar_profile.uid
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def current_profile
|
|
26
|
-
|
|
27
|
-
@current_profile = handle(profile) if current_profile_uid_from_session
|
|
28
|
-
@current_profile
|
|
26
|
+
@current_profile ||= fetch_profile_from_session
|
|
29
27
|
end
|
|
30
28
|
|
|
31
29
|
def current_profile?
|
|
@@ -38,23 +36,17 @@ module Registrar
|
|
|
38
36
|
|
|
39
37
|
private
|
|
40
38
|
|
|
41
|
-
def
|
|
42
|
-
session[CURRENT_PROFILE_UID]
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
def current_profile_uid_from_session
|
|
46
|
-
session[CURRENT_PROFILE_UID]
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def handle(profile)
|
|
50
|
-
Registrar::Middleware::config.handler.call(profile)
|
|
39
|
+
def fetch_profile_from_session
|
|
40
|
+
if session[CURRENT_PROFILE_UID]
|
|
41
|
+
Registrar::Middleware::config.handler.call(cached_profile)
|
|
42
|
+
end
|
|
51
43
|
end
|
|
52
44
|
|
|
53
|
-
def
|
|
45
|
+
def cached_profile
|
|
54
46
|
{
|
|
55
47
|
"provider" => {
|
|
56
48
|
"name" => "session",
|
|
57
|
-
"uid" =>
|
|
49
|
+
"uid" => session[CURRENT_PROFILE_UID]
|
|
58
50
|
}
|
|
59
51
|
}
|
|
60
52
|
end
|
data/test/dummy/log/test.log
CHANGED
|
@@ -932,3 +932,51 @@ CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliab
|
|
|
932
932
|
Started GET "/" for 127.0.0.1 at 2015-12-02 14:18:24 +0100
|
|
933
933
|
Processing by SomeController#index as HTML
|
|
934
934
|
Completed 200 OK in 14ms (Views: 0.2ms)
|
|
935
|
+
----------------------------------------------------------------------------------
|
|
936
|
+
CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliable
|
|
937
|
+
----------------------------------------------------------------------------------
|
|
938
|
+
Started GET "/" for 127.0.0.1 at 2015-12-02 14:26:31 +0100
|
|
939
|
+
Processing by SomeController#index as HTML
|
|
940
|
+
Completed 200 OK in 14ms (Views: 0.1ms)
|
|
941
|
+
----------------------------------------------------------------------------------
|
|
942
|
+
CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliable
|
|
943
|
+
----------------------------------------------------------------------------------
|
|
944
|
+
Started GET "/" for 127.0.0.1 at 2016-02-09 15:46:02 +0100
|
|
945
|
+
Processing by SomeController#index as HTML
|
|
946
|
+
Completed 500 Internal Server Error in 14ms
|
|
947
|
+
----------------------------------------------------------------------------------
|
|
948
|
+
CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliable
|
|
949
|
+
----------------------------------------------------------------------------------
|
|
950
|
+
Started GET "/" for 127.0.0.1 at 2016-02-09 15:47:32 +0100
|
|
951
|
+
Processing by SomeController#index as HTML
|
|
952
|
+
Completed 500 Internal Server Error in 17ms
|
|
953
|
+
----------------------------------------------------------------------------------
|
|
954
|
+
CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliable
|
|
955
|
+
----------------------------------------------------------------------------------
|
|
956
|
+
Started GET "/" for 127.0.0.1 at 2016-02-09 15:47:57 +0100
|
|
957
|
+
Processing by SomeController#index as HTML
|
|
958
|
+
Completed 200 OK in 15ms (Views: 0.2ms)
|
|
959
|
+
----------------------------------------------------------------------------------
|
|
960
|
+
CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliable
|
|
961
|
+
----------------------------------------------------------------------------------
|
|
962
|
+
Started GET "/" for 127.0.0.1 at 2016-02-09 15:48:46 +0100
|
|
963
|
+
Processing by SomeController#index as HTML
|
|
964
|
+
Completed 200 OK in 14ms (Views: 0.1ms)
|
|
965
|
+
----------------------------------------------------------------------------------
|
|
966
|
+
CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliable
|
|
967
|
+
----------------------------------------------------------------------------------
|
|
968
|
+
Started GET "/" for 127.0.0.1 at 2016-02-09 16:01:50 +0100
|
|
969
|
+
Processing by SomeController#index as HTML
|
|
970
|
+
Completed 200 OK in 14ms (Views: 0.2ms)
|
|
971
|
+
----------------------------------------------------------------------------------
|
|
972
|
+
CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliable
|
|
973
|
+
----------------------------------------------------------------------------------
|
|
974
|
+
Started GET "/" for 127.0.0.1 at 2016-02-10 10:25:39 +0100
|
|
975
|
+
Processing by SomeController#index as HTML
|
|
976
|
+
Completed 200 OK in 14ms (Views: 0.2ms)
|
|
977
|
+
----------------------------------------------------------------------------------
|
|
978
|
+
CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliable
|
|
979
|
+
----------------------------------------------------------------------------------
|
|
980
|
+
Started GET "/" for 127.0.0.1 at 2016-02-10 14:29:16 +0100
|
|
981
|
+
Processing by SomeController#index as HTML
|
|
982
|
+
Completed 200 OK in 14ms (Views: 0.1ms)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: registrar-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: '0.3'
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jan Owiesniak
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2016-02-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|