File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
lib/simple_master/master/column Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ class EnumColumn < self
1313 def initialize ( name , options )
1414 @enum = options [ :enum ]
1515 @const_name = "ENUM_FOR_#{ name . upcase } "
16- @prefix = "#{ name } _" if options [ :prefix ]
17- @suffix = "_#{ options [ :suffix ] } " if options [ :suffix ]
16+ @prefix = "#{ options [ :prefix ] == true ? name : options [ :prefix ] } _" if options [ :prefix ]
17+ @suffix = "_#{ options [ :suffix ] == true ? name : options [ :suffix ] } " if options [ :suffix ]
1818
1919 super
2020 end
@@ -64,7 +64,7 @@ def #{name}_before_type_cast
6464
6565 enum . each_key do |enum_name |
6666 # Skip generating helpers for names that start with a digit
67- next if enum_name . match? ( /\A \d / )
67+ next if enum_name . match? ( /\A \d / ) && prefix . nil?
6868 master_class . simple_master_module . class_eval <<-RUBY , __FILE__ , __LINE__ + 1
6969 def #{ prefix } #{ enum_name } #{ suffix } ?
7070 #{ name } == :#{ enum_name }
You can’t perform that action at this time.
0 commit comments