modalfields 1.2.0 → 1.2.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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.0
1
+ 1.2.1
@@ -140,6 +140,7 @@ module ModalFields
140
140
  @hooks = {}
141
141
  @definitions = {}
142
142
  @column_to_field_declaration_hook = nil
143
+ @type_aliases = {}
143
144
 
144
145
  class <<self
145
146
  attr_reader :hooks, :definitions
@@ -155,6 +156,11 @@ module ModalFields
155
156
  DefinitionsDsl.new.instance_eval(&blk)
156
157
  end
157
158
 
159
+ # Define type synonyms
160
+ def alias(aliases)
161
+ @type_aliases.merge! aliases
162
+ end
163
+
158
164
  # Run a hooks block that defines field declaration processors
159
165
  def hook(&blk)
160
166
  HooksDsl.new.instance_eval(&blk)
@@ -523,13 +529,9 @@ module ModalFields
523
529
  }
524
530
  end
525
531
 
526
- TYPE_SYNONYMS = {
527
- :timestamp => :datetime
528
- }
529
-
530
532
  def unified_type(type)
531
533
  type &&= type.to_sym
532
- TYPE_SYNONYMS[type] || type
534
+ @type_aliases[type] || type
533
535
  end
534
536
 
535
537
  def model_fields_info(model)
@@ -10,4 +10,7 @@ ModalFields.define do
10
10
  date
11
11
  binary :limit=>nil
12
12
  boolean
13
+ timestamp
13
14
  end
15
+
16
+ ModalFields.alias :timestamp=>:datetime
data/modalfields.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "modalfields"
8
- s.version = "1.2.0"
8
+ s.version = "1.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Javier Goizueta"]
12
- s.date = "2012-09-04"
12
+ s.date = "2012-09-05"
13
13
  s.description = "ModelFields is a Rails plugin that adds fields declarations to your models."
14
14
  s.email = "jgoizueta@gmail.com"
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modalfields
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-04 00:00:00.000000000 Z
12
+ date: 2012-09-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -214,7 +214,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
214
214
  version: '0'
215
215
  segments:
216
216
  - 0
217
- hash: -2875707183532562244
217
+ hash: -3564766831830068922
218
218
  required_rubygems_version: !ruby/object:Gem::Requirement
219
219
  none: false
220
220
  requirements: