Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

extract_limit regexp #10

Merged
merged 1 commit into from

2 participants

@mmichaa

replaced ^[)] with .
because regexps are greedy and the old regexp doesn't allow enum-values with brackets.

@electronick
Owner

Are brackets really needed in values? Can't really imagine usage of symbols like :'[bar]'

@mmichaa

I have used enum-values with "(" and ")" in a project. Your regexp didn't work for me. That's why I changed it.

@electronick electronick merged commit 0c3ebbe into from
@electronick
Owner

Ok, if MySql allows such values we should allow such usage too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 20, 2012
  1. @mmichaa

    patched extract_limit regexp

    mmichaa authored
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/enum/enum_adapter.rb
View
2  lib/enum/enum_adapter.rb
@@ -75,7 +75,7 @@ def simplified_type(field_type)
alias __extract_limit_enum extract_limit
def extract_limit(sql_type)
if sql_type =~ /^enum/i
- sql_type.sub(/^enum\('([^)]+)'\)/i, '\1').split("','").map { |v| v.intern }
+ sql_type.sub(/^enum\('(.+)'\)/i, '\1').split("','").map { |v| v.intern }
else
__extract_limit_enum(sql_type)
end
Something went wrong with that request. Please try again.