I'm a newbie to Ruby and web development. I'm using Windows 7 64-bit with Ruby 2.0 and I have PostgreSQL 9.4 installed.
I'm trying to use ActiveRecord to create a database. I checked that my postgresql server is running and I did bundle install to make sure I had all the required gems. When I run "bundle exec rake db:create," it looks like rake is able to find createdb.exe in the PostgreSQL directory, but for some reason it's telling me that I have too many command line arguments:
C:\Users\MH\Desktop\activerecord-template> bundle exec rake db:create
Creating activerecord-template development and test databases if they don't exist...
'createdb': too many command line-arguments (first is "postgres")
My Gemfile, Rakefile, and config.rb file are here in my prior post: createdb not recognized as a command when using ActiveRecord
I think the issue might be in the Rakefile here:
desc "Create #{APP_NAME} databases"
task "create" do
puts "Creating #{APP_NAME} development and test databases if they don't exist..."
system("createdb #{DB_NAME} --username #{DB_USERNAME} -w --no-password && createdb #{TEST_DB_NAME} --username #{DB_USERNAME} -w --no-password")
end
I tried deleting and changing the order of -w as referenced here: pg_dump: too many command line arguments, but that didn't fix the issue.
There was also some discussion about putting "your options before your option-less arguments" and the wrong order for options in these links:
http://grokbase.com/t/postgresql/pgsql-general/07avnzajn7/createdb-argument-question
http://postgresql.nabble.com/pgpass-does-not-work-for-createlang-td2118667.html
but I don't really get what that means for my code.