lib/rails/generators/generated_attribute.rb in railties-7.0.8.6 vs lib/rails/generators/generated_attribute.rb in railties-7.1.0.beta1
- old
+ new
@@ -76,9 +76,11 @@
private
# parse possible attribute options like :limit for string/text/binary/integer, :precision/:scale for decimals or :polymorphic for references/belongs_to
# when declaring options curly brackets should be used
def parse_type_and_options(type)
case type
+ when /(text|binary)\{([a-z]+)\}/
+ return $1, size: $2.to_sym
when /(string|text|binary|integer)\{(\d+)\}/
return $1, limit: $2.to_i
when /decimal\{(\d+)[,.-](\d+)\}/
return :decimal, precision: $1.to_i, scale: $2.to_i
when /(references|belongs_to)\{(.+)\}/