Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/simple_master/master/column/enum_column.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class EnumColumn < self
def initialize(name, options)
@enum = options[:enum]
@const_name = "ENUM_FOR_#{name.upcase}"
@prefix = "#{name}_" if options[:prefix]
@suffix = "_#{options[:suffix]}" if options[:suffix]
@prefix = "#{options[:prefix] == true ? name : options[:prefix]}_" if options[:prefix]
@suffix = "_#{options[:suffix] == true ? name : options[:suffix]}" if options[:suffix]

super
end
Expand Down Expand Up @@ -64,7 +64,7 @@ def #{name}_before_type_cast

enum.each_key do |enum_name|
# Skip generating helpers for names that start with a digit
next if enum_name.match?(/\A\d/)
next if enum_name.match?(/\A\d/) && prefix.nil?
master_class.simple_master_module.class_eval <<-RUBY, __FILE__, __LINE__ + 1
def #{prefix}#{enum_name}#{suffix}?
#{name} == :#{enum_name}
Expand Down