select_extra_columns 0.0.3 → 0.0.4

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/CHANGELOG.markdown CHANGED
@@ -1,6 +1,11 @@
1
+ 2010-04-08
2
+ ==========
3
+ * Added stricter validation for :extra_columns input.
4
+
5
+
1
6
  2010-03-08
2
7
  ==========
3
- * Added support for multiple input types for extra_columns
8
+ * Added support for multiple input formats for :extra_columns
4
9
 
5
10
  2010-03-08
6
11
  ==========
data/README.markdown CHANGED
@@ -67,9 +67,9 @@ Option accepts String/Symbol/Array/Hash as input.
67
67
  Example:
68
68
 
69
69
  #String,Symbol format
70
- :extra_columns => :first_name # Single string field: `first_name`
70
+ :extra_columns => :first_name # Single string field: `first_name`(type is inferred as string)
71
71
 
72
- :extra_columns => "first_name" # Single string field: `first_name`
72
+ :extra_columns => "first_name" # Single string field: `first_name`(type is inferred as string)
73
73
 
74
74
  # Hash format
75
75
  :extra_columns => { # Two string fields and a boolean field
@@ -63,8 +63,10 @@ module SelectExtraColumns
63
63
  extra_columns.each do |col_detail|
64
64
  col_detail = [col_detail] if col_detail.is_a?(Symbol) or col_detail.is_a?(String)
65
65
  next unless col_detail.is_a?(Array)
66
- col_name, col_type = col_detail[0].to_s, (col_detail[1] || "string").to_s
67
- result << ActiveRecord::ConnectionAdapters::Column.new(col_name, nil, col_type)
66
+ col_name, col_type = col_detail[0], (col_detail[1] || "string")
67
+ # ignore if not valid type
68
+ next unless [String, Symbol].include?(col_name.class) and [String, Symbol].include?(col_type.class)
69
+ result << ActiveRecord::ConnectionAdapters::Column.new(col_name.to_s, nil, col_type.to_s)
68
70
  end
69
71
  end
70
72
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 3
9
- version: 0.0.3
8
+ - 4
9
+ version: 0.0.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kandada Boggu
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-08 00:00:00 -08:00
17
+ date: 2010-03-09 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies: []
20
20