mysql - Ruby on Rails - Keep getting a error when trying to run "rake db:migrate" -
I'm new to learning Ruby on Rails and when I run "Rake DB: Migrate" I get the command line The following error is:
rack abortion! Syntax error: & gt; / User / user / name / site / sample_com / db / mgrtip 40423221836_alter_users.rb: 15: syntax & gt; Error, unexpected ':', expected ')' ... dmin_users "," email ",: string: default =>" ",: null = & gt; false) ... ^
Tasks: Top = & gt; db: Migrate (see full traces by working with --trace) **
Here is my code:
Class AlterUsers & lt; ActiveRecord :: migration def rename_table ("user", "admin_users") add_column ("admin_users" Change_column ("admin_users", "email",: string ,: border => 100) rename_column ("admin_users", "username" ,: string ,: border => after 25, => "email" ("admin_users", "user no "Add_index" ("admin_users", "username") puts def def remove remove_index ("admin_users", "username") rename_column ("admin_users", "password", "hashed_password") *** ("admin_users" , "username", "user") end end
I check and check my code, but the solution can not be found ... is there any better tracking of me Can anyone see? Thanks!
Below On the third line of the method, You comma
change_column ("admin_users", "email",: Tring: default = & gt; ",: Null = & gt; false) ^ ## Missing Comma
That's why you got the error as the
unexpected ':' ',' expecting ') "Dmin_users", "email",: string: default =>,:: null => wrong)
just, comma between
: string and
: default and run
rake db: migrate .
Comments
Post a Comment