effective_regions 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/effective/regions_controller.rb +14 -1
- data/lib/effective_regions/version.rb +1 -1
- 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: 898f48156e4d032aa0f3fbfa1573c23e37eab233
|
4
|
+
data.tar.gz: 8c5d860b6f5e1345cfdc73e6c2b0cce02b59d546
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 506499a34084633a4bc25a224f3d3e66fbf115f81433f5ea8236b455c819f585bd173a0ee76387f2e8c2dc56175382dbc51b445a0cfca101ed358e9a65781bea
|
7
|
+
data.tar.gz: e63b58a5f284714248405d1d7eda1f5b418a9a934770ac503c9d3cc419cc53c58b14785abb3ec220580ed94b7f78c12f65c9be8a9187799890261a024c350a5c
|
@@ -114,7 +114,20 @@ module Effective
|
|
114
114
|
title = nil
|
115
115
|
|
116
116
|
if(class_name, id, title = key.scan(/(\w+)_(\d+)_(\w+)/).flatten).present?
|
117
|
-
|
117
|
+
# The problem here is that class_name could have a namespace prepended to it
|
118
|
+
klass = class_name.classify.safe_constantize
|
119
|
+
|
120
|
+
if klass == nil && (pieces = class_name.split('_')).length > 1
|
121
|
+
pieces.each_with_index do |piece, index|
|
122
|
+
potential_namespace = pieces[0..index].join('_')
|
123
|
+
potential_classname = (pieces.last(pieces.length-index-1).join('_') rescue '')
|
124
|
+
|
125
|
+
klass = "#{potential_namespace.classify}::#{potential_classname.classify}".safe_constantize
|
126
|
+
break if klass
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
regionable = (klass.find(id) rescue nil)
|
118
131
|
end
|
119
132
|
|
120
133
|
return regionable, (title || key)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_regions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
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: 2014-12-
|
11
|
+
date: 2014-12-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|