Wrong number of arguments in db:seed error

When running a rake db:seed or db:setup, if you find that you get an error like this (although numbers may be different)…

wrong number of arguments (3 for 1)

Then make sure you check your seeds.rb file. The following will produce this error;

Category.create[
  {:name => 'starters'},
  {:name => 'main courses'},
  {:name => 'desserts'}
]

It’s basically caused by there being no space after the “.create”. Just add a space in there and you should be good to go.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s