Ruby On Rails: creating a new record brings up a error: syntax error, unexpected ',', expecting end-of-input
Ruby On Rails: creating a new record brings up a error: syntax error, unexpected ',', expecting end-of-input
我正在努力查看此声明哪里出了问题
我使用相同的语法在我的数据库中创建了其他记录。
但是直到现在我还没有遇到使用 => 或逗号的问题。
Loading development environment (Rails 5.0.1)
irb(main):006:0> me = AdminUser.create (:first_name => "test", :last_name => "user", :username => "tuser")
SyntaxError: (irb):1: syntax error, unexpected =>, expecting ')'
...dminUser.create (:first_name => "test", :last_name => "user"...
... ^
(irb):1: syntax error, unexpected ',', expecting end-of-input
....create (:first_name => "test", :last_name => "user", :usern...
... ^
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/console.rb:65:in `start'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/console_helper.rb:9:in `start'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:78:in `console'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands.rb:18:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
irb(main):002:0>
你多了一个space
我= AdminUser.create(:first_name => "test", :last_name => "user", :用户名=> "tuser" )
我正在努力查看此声明哪里出了问题
我使用相同的语法在我的数据库中创建了其他记录。
但是直到现在我还没有遇到使用 => 或逗号的问题。
Loading development environment (Rails 5.0.1)
irb(main):006:0> me = AdminUser.create (:first_name => "test", :last_name => "user", :username => "tuser")
SyntaxError: (irb):1: syntax error, unexpected =>, expecting ')'
...dminUser.create (:first_name => "test", :last_name => "user"...
... ^
(irb):1: syntax error, unexpected ',', expecting end-of-input
....create (:first_name => "test", :last_name => "user", :usern...
... ^
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/console.rb:65:in `start'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/console_helper.rb:9:in `start'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:78:in `console'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands.rb:18:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
irb(main):002:0>
你多了一个space
我= AdminUser.create(:first_name => "test", :last_name => "user", :用户名=> "tuser" )