search for: extract_enum_values

Displaying 1 result from an estimated 1 matches for "extract_enum_values".

2006 Feb 05
0
Enum patch for Rails
...when :boolean then "#{self.class.name}.value_to_boolean(#{var_name})" + when :enum then "#{var_name}.to_s.intern" else nil end end @@ -135,6 +138,26 @@ $1.to_i if sql_type =~ /\((.*)\)/ end + def extract_enum_values(sql_type) + paren_string = $1 if sql_type =~ /\((.*)\)/ + return [] if paren_string.nil? + values = [] + paren_string.split(",").each do |item| + item.strip! + item = item[1..-2] if item[0] == ?'' && item[-1] == ?...