Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I was using rails to create a sqlite table in my application, I tried an example from a tutorial which I typed the command:

rails generate scaffold Product \
     title:string description:text image_url:string price:decimal

It worked and generated a table, however, when I ran

rake db:migrate

It came up some problem:

SyntaxError in ProductsController#index
products_controller.rb:72: syntax error, unexpected ':', expecting ')' ...rams.require(:product).permit(: title, :description, :image_... ... ^ 

So I looked into the table and found that there's an extra space between title and string, it's like this:

title : string
description :text
image_url :string
price :decimal

Then I changed it and the corresponding controller. The controller was like this before I changed it, also an extra space here:

 def product_params
      params.require(:product).permit(: title, :description, :image_url, :price)

After that, whenever I tried to create a table, the same problem came again and again. The first attribute always has an extra space while the following attributes don't. So anyone knows what's the problem? Thank you so much! :)

share|improve this question
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.