Search code examples
rubysyntaxubuntugedit

Ruby: Ubuntu Gedit Problem possible with Spaces


can someone tell me why this works in my gedit on ubuntu

def initialize (product_id,category_id,category_name)

but this does not. It thows a syntax error and says that I am missing a ")"

def initialize (product_id, category_id, category_name)

I spent about 2 hours running through all the rest of my code and this is what fixed the syntax error. I had to change it where I call the method and in its definition. The rest of my code is 100% the same.. Is gedit doing something with my spaces? Thanks


Solution

  • You're not supposed to have a space between the method name and the arguments list for that method. It should be:

    def initialize(product_id, category_id, category_name)