has_custom_fields 0.0.2 → 0.0.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/VERSION +1 -1
- data/has_custom_fields.gemspec +1 -1
- data/has_custom_fields.tmproj +1 -1
- data/lib/custom_fields/custom_field_base.rb +3 -3
- data/lib/has_custom_fields.rb +2 -3
- metadata +1 -1
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.3
|
data/has_custom_fields.gemspec
CHANGED
data/has_custom_fields.tmproj
CHANGED
|
@@ -4,7 +4,7 @@ module CustomFields
|
|
|
4
4
|
serialize :select_options
|
|
5
5
|
validates_presence_of :name,
|
|
6
6
|
:message => 'Please specify the field name.'
|
|
7
|
-
validates_presence_of :
|
|
7
|
+
validates_presence_of :select_options_data,
|
|
8
8
|
:if => "self.style.to_sym == :select",
|
|
9
9
|
:message => "You must enter options for the selection, separated by commas."
|
|
10
10
|
|
|
@@ -16,11 +16,11 @@ module CustomFields
|
|
|
16
16
|
FOO
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
def
|
|
19
|
+
def select_options_data
|
|
20
20
|
(self.select_options || []).join(",")
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
def
|
|
23
|
+
def select_options_data=(csv)
|
|
24
24
|
self.select_options = csv.split(",").collect{|f| f.strip}
|
|
25
25
|
end
|
|
26
26
|
|
data/lib/has_custom_fields.rb
CHANGED
|
@@ -221,8 +221,8 @@ module ActiveRecord # :nodoc:
|
|
|
221
221
|
ActiveRecord::Base.transaction do
|
|
222
222
|
|
|
223
223
|
self.connection.create_table(options[:fields_table_name], options) do |t|
|
|
224
|
-
t.string options[:name_field], :null => false
|
|
225
|
-
t.string :style, :null => false
|
|
224
|
+
t.string options[:name_field], :null => false, :limit => 63
|
|
225
|
+
t.string :style, :null => false, :limit => 15
|
|
226
226
|
t.string :select_options
|
|
227
227
|
scope_fkeys.each do |s|
|
|
228
228
|
t.integer s
|
|
@@ -253,7 +253,6 @@ module ActiveRecord # :nodoc:
|
|
|
253
253
|
t.integer options[:foreign_key], :null => false
|
|
254
254
|
t.integer options[:fields_table_name].foreign_key, :null => false
|
|
255
255
|
t.string options[:value_field], :null => false
|
|
256
|
-
|
|
257
256
|
t.timestamps
|
|
258
257
|
end
|
|
259
258
|
|