custom_fields 1.0.0.beta.22 → 1.0.0.beta.23

Sign up to get free protection for your applications and to get access to all the features.
@@ -26,7 +26,7 @@ module CustomFields
26
26
 
27
27
  ## validations ##
28
28
  validates_presence_of :label, :kind
29
- validates_exclusion_of :_alias, :in => Module.new {
29
+ validates_exclusion_of :_alias, :in => Module.new {
30
30
  def self.include?(el); CustomFields.options[:reserved_aliases].include?(el); end
31
31
  }
32
32
  validates_format_of :_alias, :with => /^[a-z]([A-Za-z0-9_]+)?$/
@@ -136,7 +136,7 @@ module CustomFields
136
136
 
137
137
  def set_alias
138
138
  return if self.label.blank? && self._alias.blank?
139
-
139
+
140
140
  if self._alias.blank?
141
141
  self._alias = self.label.parameterize('_').gsub('-', '_').downcase
142
142
  end
@@ -1,29 +1,29 @@
1
1
  module CustomFields
2
2
  module Types
3
3
  module Boolean
4
-
4
+
5
5
  extend ActiveSupport::Concern
6
-
6
+
7
7
  included do
8
8
  register_type :boolean
9
9
  end
10
-
10
+
11
11
  module InstanceMethods
12
-
12
+
13
13
  def apply_boolean_type(klass)
14
-
14
+
15
15
  klass.class_eval <<-EOF
16
16
  alias :#{self.safe_alias}= :#{self._name}=
17
-
17
+
18
18
  def #{self.safe_alias}
19
- ::Boolean.set(read_attribute(:#{self._name}))
20
- end
19
+ ::Boolean.set(self.send(:#{self._name}))
20
+ end
21
21
  EOF
22
-
22
+
23
23
  end
24
-
24
+
25
25
  end
26
-
26
+
27
27
  end
28
28
  end
29
29
  end
@@ -63,11 +63,11 @@ module CustomFields
63
63
  def #{self.safe_alias}=(id)
64
64
  category = self.class.#{self.safe_alias}_items.find { |item| item.name == id || item._id.to_s == id.to_s }
65
65
  category_id = category ? category._id : nil
66
- write_attribute(:#{self._name}, category_id)
66
+ self.send(:'#{self._name}=', category_id)
67
67
  end
68
68
 
69
69
  def #{self.safe_alias}
70
- category_id = read_attribute(:#{self._name})
70
+ category_id = self.send(:#{self._name})
71
71
  category = self.class.#{self.safe_alias}_items.find { |item| item._id == category_id }
72
72
  category ? category.name : nil
73
73
  end
@@ -35,7 +35,7 @@ module CustomFields
35
35
  def #{self.safe_alias}
36
36
  return @_#{self._name} unless @_#{self._name}.blank? # memoization
37
37
 
38
- target_id = read_attribute(:#{self._name})
38
+ target_id = self.send(:#{self._name})
39
39
 
40
40
  return nil if target_id.blank?
41
41
 
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module CustomFields
3
- VERSION = "1.0.0.beta.22"
3
+ VERSION = "1.0.0.beta.23"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,8 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: custom_fields
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 62196397
4
5
  prerelease: 6
5
- version: 1.0.0.beta.22
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 0
10
+ - beta
11
+ - 23
12
+ version: 1.0.0.beta.23
6
13
  platform: ruby
7
14
  authors:
8
15
  - Didier Lafforgue
@@ -10,31 +17,40 @@ autorequire:
10
17
  bindir: bin
11
18
  cert_chain: []
12
19
 
13
- date: 2011-08-11 00:00:00 -07:00
14
- default_executable:
20
+ date: 2011-08-17 00:00:00 Z
15
21
  dependencies:
16
22
  - !ruby/object:Gem::Dependency
17
23
  name: mongoid
18
- requirement: &id001 !ruby/object:Gem::Requirement
24
+ prerelease: false
25
+ type: :runtime
26
+ version_requirements: &id001 !ruby/object:Gem::Requirement
19
27
  none: false
20
28
  requirements:
21
29
  - - "="
22
30
  - !ruby/object:Gem::Version
31
+ hash: 11
32
+ segments:
33
+ - 2
34
+ - 0
35
+ - 2
23
36
  version: 2.0.2
24
- type: :runtime
25
- prerelease: false
26
- version_requirements: *id001
37
+ requirement: *id001
27
38
  - !ruby/object:Gem::Dependency
28
39
  name: activesupport
29
- requirement: &id002 !ruby/object:Gem::Requirement
40
+ prerelease: false
41
+ type: :runtime
42
+ version_requirements: &id002 !ruby/object:Gem::Requirement
30
43
  none: false
31
44
  requirements:
32
45
  - - ~>
33
46
  - !ruby/object:Gem::Version
47
+ hash: 21
48
+ segments:
49
+ - 3
50
+ - 0
51
+ - 9
34
52
  version: 3.0.9
35
- type: :runtime
36
- prerelease: false
37
- version_requirements: *id002
53
+ requirement: *id002
38
54
  description: Manage custom fields to a mongoid document or a collection. This module is one of the core features we implemented in our custom cms named Locomotive.
39
55
  email:
40
56
  - didier@nocoffee.fr
@@ -73,7 +89,6 @@ files:
73
89
  - config/locales/en.yml
74
90
  - config/locales/fr.yml
75
91
  - config/locales/pt-BR.yml
76
- has_rdoc: true
77
92
  homepage: http://github.com/locomotivecms/custom_fields
78
93
  licenses: []
79
94
 
@@ -87,7 +102,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
87
102
  requirements:
88
103
  - - ">="
89
104
  - !ruby/object:Gem::Version
90
- hash: -2478047520408348975
105
+ hash: 3
91
106
  segments:
92
107
  - 0
93
108
  version: "0"
@@ -96,11 +111,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
111
  requirements:
97
112
  - - ">="
98
113
  - !ruby/object:Gem::Version
114
+ hash: 23
115
+ segments:
116
+ - 1
117
+ - 3
118
+ - 6
99
119
  version: 1.3.6
100
120
  requirements: []
101
121
 
102
122
  rubyforge_project: nowarning
103
- rubygems_version: 1.6.2
123
+ rubygems_version: 1.8.5
104
124
  signing_key:
105
125
  specification_version: 3
106
126
  summary: Custom fields extension for Mongoid