unidom-geo 1.0.1 → 1.1
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/README.md +16 -0
- data/app/models/unidom/geo/concerns/as_located.rb +15 -0
- data/app/models/unidom/geo/concerns/as_region.rb +15 -0
- data/lib/unidom/geo/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c45e31e1ee141061b5ce9d4a8555cad2e972352
|
4
|
+
data.tar.gz: 10a83320f101878f1c165e5658567967a1eca23d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c4d28720aa4e64f3b6c79a18f8a440fe853dc07d01088fe1d719257e3d3e9b9bfa2628e2f4041dee132d7dc0ecec3d3acc3a62be43805a1eb589f10892161b3
|
7
|
+
data.tar.gz: 79cda3a5bc8a42c34251dd6fc4599998eee8c7a9bf0bd397e09de2a6b5bc668557e128d94f91ee2cd62adb4b1c3576a9849707fa49cc9f8c2bd249681c0c1a19
|
data/README.md
CHANGED
@@ -32,3 +32,19 @@ location.locate! shop, by: person
|
|
32
32
|
# or
|
33
33
|
Unidom::Geo::Locating.locate! location: location, located: shop
|
34
34
|
```
|
35
|
+
|
36
|
+
## Include the Concerns:
|
37
|
+
```ruby
|
38
|
+
include Unidom::Geo::Concerns::AsLocated
|
39
|
+
include Unidom::Geo::Concerns::AsRegion
|
40
|
+
```
|
41
|
+
|
42
|
+
### As Located concern
|
43
|
+
The As Located concern do the following tasks for the includer automatically:
|
44
|
+
1. Define the has_many :locatings macro as: ``has_many :locatings, class_name: 'Unidom::Geo::Locating', as: :located``
|
45
|
+
2. Define the has_many :locations macro as: ``has_many :locations, through: :locatings, source: :location``
|
46
|
+
|
47
|
+
### As Region concern
|
48
|
+
The As Region concern do the following tasks for the includer automatically:
|
49
|
+
1. Define the has_many :locations macro as: ``has_many :locations, class_name: 'Unidom::Geo::Location'``
|
50
|
+
2. Define the has_many :locatings macro as: ``has_many :locatings, through: :locations, source: :locatings``
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Unidom::Geo::Concerns::AsLocated
|
2
|
+
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do |includer|
|
6
|
+
|
7
|
+
has_many :locatings, class_name: 'Unidom::Geo::Locating', as: :located
|
8
|
+
has_many :locations, through: :locatings, source: :location
|
9
|
+
|
10
|
+
end
|
11
|
+
|
12
|
+
module ClassMethods
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Unidom::Geo::Concerns::AsRegion
|
2
|
+
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do |includer|
|
6
|
+
|
7
|
+
has_many :locations, class_name: 'Unidom::Geo::Location'
|
8
|
+
has_many :locatings, through: :locations, source: :locatings
|
9
|
+
|
10
|
+
end
|
11
|
+
|
12
|
+
module ClassMethods
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
data/lib/unidom/geo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unidom-geo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: '1.1'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Topbit Du
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|
@@ -39,6 +39,8 @@ files:
|
|
39
39
|
- app/assets/stylesheets/unidom/geo/application.css
|
40
40
|
- app/controllers/unidom/geo/application_controller.rb
|
41
41
|
- app/helpers/unidom/geo/application_helper.rb
|
42
|
+
- app/models/unidom/geo/concerns/as_located.rb
|
43
|
+
- app/models/unidom/geo/concerns/as_region.rb
|
42
44
|
- app/models/unidom/geo/locating.rb
|
43
45
|
- app/models/unidom/geo/location.rb
|
44
46
|
- app/views/layouts/unidom/geo/application.html.erb
|