unidom-geo 1.0.1 → 1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f1b4a986c353ed462a028705fd605a8faa3c943a
4
- data.tar.gz: 27850a72acb3a19c14eb375302eaca922c8c0d85
3
+ metadata.gz: 1c45e31e1ee141061b5ce9d4a8555cad2e972352
4
+ data.tar.gz: 10a83320f101878f1c165e5658567967a1eca23d
5
5
  SHA512:
6
- metadata.gz: 456de6b58ad6bab699d910e3078e3bd1e95f9b7393f0a78b1c7a44e45dec118b19b1cc855252acb1c4c1b3a6264fbfa8a728cb47ce6302ccb78be9cfb5b41918
7
- data.tar.gz: 160d484707ec8ea825152f3352500a1637d8b777cfb81955facf4213757aae1cbed79a57d2af13c7382302ff5a7684713f6073603b6bdbd2fe0fee1e60f972a8
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
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Geo
3
- VERSION = '1.0.1'.freeze
3
+ VERSION = '1.1'.freeze
4
4
  end
5
5
  end
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.0.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-15 00:00:00.000000000 Z
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