ruby on rails - Create Migration for Column with a Number in the Name -


i'm porting app rails , couple of columns named things like

2nd_phone 2nd_address

when try doing migration using t.string :2nd_phone

i syntax error, unexpected tinteger, expecting tstring_content or tstring_dbeg or tstring_dvar or tstring_end

any ideas how in rals?

in migration file have quotes support starting character numeric 1 , run rake db:migrate

t.string :'2nd_phone' 

while doing way if want create new record need have this:

model.create(:'2nd_phone'=> 'your value') 

Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -