README.md in unidom-geo-1.2 vs README.md in unidom-geo-1.3
- old
+ new
@@ -4,26 +4,38 @@
[![Gem Version](https://badge.fury.io/rb/unidom-geo.svg)](https://badge.fury.io/rb/unidom-geo)
Unidom (UNIfied Domain Object Model) is a series of domain model engines. The Geo domain model engine includes Town and Location models.
Unidom (统一领域对象模型)是一系列的领域模型引擎。地理领域模型引擎包括乡镇和街道地址的模型。
+
+
## Recent Update
+
Check out the [Road Map](ROADMAP.md) to find out what's the next.
Check out the [Change Log](CHANGELOG.md) to find out what's new.
+
+
## Usage in Gemfile:
+
```ruby
gem 'unidom-geo'
```
+
+
## Run the Database Migration:
+
```shell
rake db:migrate
```
The migration versions start with 200104.
+
+
## Call the Model:
+
```ruby
Unidom::Geo::Location.valid_at.alive.first.region
active_locatings = location.locatings.valid_at.alive
@@ -34,21 +46,31 @@
# Determine whether a shop was located to a given location at a given time.
location.locate? shop, at: Time.now
```
+
+
## Include the Concerns:
+
```ruby
include Unidom::Geo::Concerns::AsLocated
+include Unidom::Geo::Concerns::AsLocator
include Unidom::Geo::Concerns::AsRegion
```
### As Located concern
The As Located concern do the following tasks for the includer automatically:
-1. Define the has_many :locatings macro as: ``has_many :locatings, class_name: 'Unidom::Geo::Locating', as: :located``
-2. Define the has_many :locations macro as: ``has_many :locations, through: :locatings, source: :location``
-3. Define the #is_located! method as: ``is_located!(to: nil, by: nil, at: Time.now)``
+1. Define the has_many :locatings macro as: ``has_many :locatings, class_name: 'Unidom::Geo::Locating', as: :located``
+2. Define the has_many :locations macro as: ``has_many :locations, through: :locatings, source: :location``
+3. Define the #is_located! method as: ``is_located!(to: nil, by: nil, at: Time.now)``
+4. Define the #is_located? method as: ``is_located?(to: nil, at: Time.now)``
+### As Locator concern
+The As Locator concern do the following tasks for the includer automatically:
+1. Define the has_many :locatings macro as: ``has_many :locatings, class_name: 'Unidom::Geo::Locating', as: :locator``
+2. Define the has_many :locations macro as: ``has_many :locations, through: :locatings, source: :location``
+
### As Region concern
The As Region concern do the following tasks for the includer automatically:
-1. Define the has_many :locations macro as: ``has_many :locations, class_name: 'Unidom::Geo::Location'``
+1. Define the has_many :locations macro as: ``has_many :locations, class_name: 'Unidom::Geo::Location'``
2. Define the has_many :locatings macro as: ``has_many :locatings, through: :locations, source: :locatings``