unidom-common 0.6 → 0.7
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 +7 -1
- data/app/models/unidom/common/concerns/model_extension.rb +7 -0
- data/lib/unidom/common/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: b96f049bc613e7a49dddeb8822ca4910070ab5f8
|
|
4
|
+
data.tar.gz: 684e39544b8284dc7ac5910b8c55a94aa2223b81
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5fd975d280c9992f6b82e0d1ed47d35ac3d28ae46d525771e3e30102451564ca9e2cd1ed8a8be47c6e662105718477ff0cb659d1d7df001f4aa911b4f38bd57b
|
|
7
|
+
data.tar.gz: 327407dd19b9d2f96161fb995b01980e8fa87db212653c63b276f0663214c36dbcae02d381f9387822a501ea111f1fd663e63adc7e528906c88cdf64288ac77d
|
data/README.md
CHANGED
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
Unidom (UNIfied Domain Object Model) is a series of domain model engines. The Common domain model engine includes the common models.
|
|
7
7
|
Unidom (统一领域对象模型)是一系列的领域模型引擎。常用领域模型引擎包括一些常用的模型。
|
|
8
8
|
|
|
9
|
+
## Recent Update
|
|
10
|
+
Check out the [Road Map](ROADMAP.md) to find out what's the next.
|
|
11
|
+
Check out the [Change Log](CHANGELOG.md) to find out what's new.
|
|
12
|
+
|
|
9
13
|
## Usage in Gemfile
|
|
10
14
|
```ruby
|
|
11
15
|
gem 'unidom-common'
|
|
@@ -28,7 +32,8 @@ class Project < ActiveRecord::Base
|
|
|
28
32
|
|
|
29
33
|
include Unidom::Common::Concerns::ModelExtension
|
|
30
34
|
|
|
31
|
-
validates :name,
|
|
35
|
+
validates :name, presence: true, length: { in: 2..200 }
|
|
36
|
+
validates :audition_state, presence: true, length: { is: 1 }
|
|
32
37
|
|
|
33
38
|
belongs_to :customer
|
|
34
39
|
belongs_to :team
|
|
@@ -44,6 +49,7 @@ Project.created_after('2015-01-01 00:00:00')
|
|
|
44
49
|
Project.created_not_after('2015-01-01 00:00:00')
|
|
45
50
|
Project.created_before('2015-01-01 00:00:00')
|
|
46
51
|
Project.created_not_before('2015-01-01 00:00:00')
|
|
52
|
+
Project.audition_transited_to('A').transited_to('C')
|
|
47
53
|
```
|
|
48
54
|
|
|
49
55
|
## No-SQL Columns
|
|
@@ -100,6 +100,13 @@ module Unidom
|
|
|
100
100
|
end
|
|
101
101
|
end
|
|
102
102
|
|
|
103
|
+
if name.ends_with? '_state'
|
|
104
|
+
matched = /\A(.+)_state\z/.match name
|
|
105
|
+
class_eval do
|
|
106
|
+
scope :"#{matched[1]}_transited_to", ->(states) { where name => states }
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
103
110
|
end
|
|
104
111
|
|
|
105
112
|
includer.define_singleton_method :default_scope do
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: unidom-common
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: '0.
|
|
4
|
+
version: '0.7'
|
|
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-03-
|
|
11
|
+
date: 2016-03-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|