active_record_schema 0.3.2 → 0.3.3
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.
- data/README.md +22 -2
- data/VERSION +1 -1
- data/active_record_schema.gemspec +1 -1
- metadata +2 -2
data/README.md
CHANGED
|
@@ -26,6 +26,26 @@ and update your bundle
|
|
|
26
26
|
|
|
27
27
|
**NOTE:** ActiveRecordSchema depends on `rails ~> 3.0` and not only `ActiveRecord`
|
|
28
28
|
|
|
29
|
+
## Configuration
|
|
30
|
+
|
|
31
|
+
In order to correctly solve the required fields for the inheritance ActiveRecordSchema requires that all classes of models are loaded in memory when generating migration. This is done by pre-loading models in the generator. To figure out which file to load ARS refers to the global configuration property in `ActiveRecordSchema.config.autoload_paths` that is set by default to:
|
|
32
|
+
|
|
33
|
+
``` rb
|
|
34
|
+
[
|
|
35
|
+
Rails.root.join('app', 'models', '*.rb'),
|
|
36
|
+
Rails.root.join('app', 'models', '**', '*.rb')
|
|
37
|
+
]
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
You can change this by creating an initializer and setting or appending new paths to `ActiveRecordSchema.config.autoload_paths`
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
``` rb
|
|
44
|
+
# active_record_schema_initializer.rb
|
|
45
|
+
ActiveRecordSchema.config.autoload_paths << Rails.root.join('lib', 'models', '*.rb')
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
|
|
29
49
|
## Usage
|
|
30
50
|
|
|
31
51
|
Create a model and use the class method `#field` to define columns
|
|
@@ -195,7 +215,7 @@ end
|
|
|
195
215
|
|
|
196
216
|
## Mixins
|
|
197
217
|
|
|
198
|
-
Probably one of the most significant advantage given by ActiveRecordSchema is to allow the definition of fields in modules and reuse them through
|
|
218
|
+
Probably one of the most significant advantage given by ActiveRecordSchema is to allow the definition of fields in modules and reuse them through mixins
|
|
199
219
|
|
|
200
220
|
_ex._
|
|
201
221
|
|
|
@@ -229,7 +249,7 @@ end
|
|
|
229
249
|
|
|
230
250
|
#### options
|
|
231
251
|
|
|
232
|
-
* **:as _or_
|
|
252
|
+
* **:as** _or_ **:type** : Specify the type of the column. The value can be a `String`, a `Symbol` or a `Class`, default to `:string`
|
|
233
253
|
* **:index** : Specify wether or not the field should be indexed, default to `false`
|
|
234
254
|
|
|
235
255
|
#### examples
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.3.
|
|
1
|
+
0.3.3
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: active_record_schema
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.3
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -89,7 +89,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
89
89
|
version: '0'
|
|
90
90
|
segments:
|
|
91
91
|
- 0
|
|
92
|
-
hash: -
|
|
92
|
+
hash: -291946227071638021
|
|
93
93
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
94
|
none: false
|
|
95
95
|
requirements:
|