error with rails server command - sql

Can you point me to any good resources that show how to connect Sql Server to Rails app (Windows 7)?
I have done the following so far:
rails new simple_cms –d sqlserver
gem install bundle
rails s
after the last command, this error is thrown:
C:\Sites\s_cms>rails s
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-4.1.1/lib/active_support/core_ext/module/aliasing.rb:32:in `alias_method': undefined method `add_order!' for class `Class' (Name
Error)
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-4.1.1/lib/active_support/core_ext/module/aliasing.rb:32:in `alias_method_chain'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-sqlserver-adapter-2.3.8/lib/active_record/connection_adapters/sqlserver_adapter/core_ext/active_record.rb:14:in `singletonclass'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-sqlserver-adapter-2.3.8/lib/active_record/connection_adapters/sqlserver_adapter/core_ext/active_record.rb:12:in `inc
luded'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-sqlserver-adapter-2.3.8/lib/active_record/connection_adapters/sqlserver_adapter/core_ext/active_record.rb:145:in `in
clude'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-sqlserver-adapter-2.3.8/lib/active_record/connection_adapters/sqlserver_adapter/core_ext/active_record.rb:145:in `<t
op (required)>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-sqlserver-adapter-2.3.8/lib/active_record/connection_adapters/sqlserver_adapter.rb:3:in `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-sqlserver-adapter-2.3.8/lib/active_record/connection_adapters/sqlserver_adapter.rb:3:in `<top (required)>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-sqlserver-adapter-2.3.8/lib/activerecord-sqlserver-adapter.rb:1:in `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-sqlserver-adapter-2.3.8/lib/activerecord-sqlserver-adapter.rb:1:in `<top (required)>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.6.1/lib/bundler/runtime.rb:76:in `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.6.1/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.6.1/lib/bundler/runtime.rb:72:in `each'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.6.1/lib/bundler/runtime.rb:72:in `block in require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.6.1/lib/bundler/runtime.rb:61:in `each'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.6.1/lib/bundler/runtime.rb:61:in `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.6.1/lib/bundler.rb:132:in `require'
from C:/Sites/s_cms/config/application.rb:7:in `<top (required)>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:79:in `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:79:in `block in server'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:76:in `tap'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:76:in `server'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-4.1.1/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
PS: If I use sqlite as a database system, I am able to successfully start the webserver (no error). This probably means there's nothing wrong with my rails installation. I am guessing I might need to add sth to database.yml or write the database user and password somewhere. But how come this is not required with sqlite3?
I also found this resource but not sure if still applicable (it refers to rails 2.0, whereas I use rails 4.1.1) http://rubyrailsandwindows.blogspot.de/2008/03/rails-2-and-sql-server-2008-on-windows_24.html - and some of the things there I tried but don't apply.
Thanks in advance.
Later edit: I also tried rails s after editing the database.yml (from the config folder) to contain:
development:
adapter: sqlserver
encoding: unicode
database: cms
pool: 5
username: guest1
password: pwd1234%^&^
test:
adapter: sqlserver
encoding: unicode
database: cms
pool: 5
username: guest1
password: pwd1234%^&^
production:
adapter: sqlserver
encoding: unicode
database: cms
pool: 5
username: guest1
password: pwd1234%^&^
(of course, I also created previously a db called cms, and added a user called guest1 with the specified password, then made sure teh credentials worked to connect to the db by mimic-ing network connection from my local Sql Server itself)
After this new action I get a similar error as above:
C:\Sites\simple_cms>rails s
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-.1.1/lib/active_support/core_ext/module/aliasing.rb:32:in `alias_method': undefined method `add_order!' for class `Class' (Name Error)
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-4.1.1/lib/active_support/core_ext/module/aliasing.rb:32:in `alias_method_chain'
...............

This is a known bug with activerecord-sqlserver-adapter. It's being worked on but any fix has not yet been merged into a milestone.
It appears the workaround just now is to change your Gemfile to have:
gem 'activerecord-sqlserver-adapter', git: 'https://github.com/Desarrollo-CeSPI/activerecord-sqlserver-adapter.git'
Details of the issue are here and the efforts to fix it are here.

Related

Appium Ruby Console (ARC) complains HTTP request path is empty (ArgumentError)

I'm a beginner to appium, or even the language node.js or ruby. So I completely follow the tutorial when installing appium. When I ran the command arc, got the error:
/Users/kenmux/.rbenv/versions/2.1.5/lib/ruby/2.1.0/net/http/generic_request.rb:27:in `initialize': HTTP request path is empty (ArgumentError)
from /Users/kenmux/.rbenv/versions/2.1.5/lib/ruby/2.1.0/net/http/request.rb:14:in `initialize'
from /Users/kenmux/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/remote/http/default.rb:71:in `new'
from /Users/kenmux/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/remote/http/default.rb:71:in `new_request_for'
from /Users/kenmux/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/remote/http/default.rb:35:in `request'
from /Users/kenmux/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/remote/http/default.rb:64:in `request'
from /Users/kenmux/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
from /Users/kenmux/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/appium_lib-5.0.0/lib/appium_lib/common/patch.rb:118:in `raw_execute'
from /Users/kenmux/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/remote/bridge.rb:101:in `create_session'
from /Users/kenmux/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/remote/bridge.rb:68:in `initialize'
from /Users/kenmux/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/common/driver.rb:33:in `new'
from /Users/kenmux/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/common/driver.rb:33:in `for'
from /Users/kenmux/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver.rb:67:in `for'
from /Users/kenmux/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/appium_lib-5.0.0/lib/appium_lib/driver.rb:477:in `start_driver'
from /Users/kenmux/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/appium_console-1.0.3/lib/start.rb:16:in `<top (required)>'
from /Users/kenmux/.rbenv/versions/2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/kenmux/.rbenv/versions/2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/kenmux/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pry-0.9.12.6/lib/pry/pry_class.rb:96:in `block in load_requires'
from /Users/kenmux/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pry-0.9.12.6/lib/pry/pry_class.rb:95:in `each'
from /Users/kenmux/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pry-0.9.12.6/lib/pry/pry_class.rb:95:in `load_requires'
from /Users/kenmux/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pry-0.9.12.6/lib/pry/pry_class.rb:117:in `initial_session_setup'
from /Users/kenmux/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pry-0.9.12.6/lib/pry/pry_class.rb:142:in `start'
from /Users/kenmux/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pry-0.9.12.6/lib/pry/cli.rb:201:in `block in <top (required)>'
from /Users/kenmux/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pry-0.9.12.6/lib/pry/cli.rb:70:in `call'
from /Users/kenmux/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pry-0.9.12.6/lib/pry/cli.rb:70:in `block in parse_options'
from /Users/kenmux/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pry-0.9.12.6/lib/pry/cli.rb:70:in `each'
from /Users/kenmux/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pry-0.9.12.6/lib/pry/cli.rb:70:in `parse_options'
from /Users/kenmux/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/appium_console-1.0.3/lib/appium_console.rb:49:in `<module:Console>'
from /Users/kenmux/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/appium_console-1.0.3/lib/appium_console.rb:31:in `<module:Appium>'
from /Users/kenmux/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/appium_console-1.0.3/lib/appium_console.rb:30:in `<top (required)>'
from /Users/kenmux/.rbenv/versions/2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/kenmux/.rbenv/versions/2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/kenmux/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/appium_console-1.0.3/bin/arc:66:in `<top (required)>'
from /Users/kenmux/.rbenv/versions/2.1.5/bin/arc:23:in `load'
from /Users/kenmux/.rbenv/versions/2.1.5/bin/arc:23:in `<main>'
Then what should I do? Am I missing something? I just cannot get over it!
I had this same issue when I was at work and had a proxy server in my .bash_profile
Open up a terminal and type:
cat ~/.bash_profile
That will show you what is in your profile.
my .bash_profile had the below.
export http_proxy="http://127.0.0.1:8888"
export https_proxy=$http_proxy
export ftp_proxy=$http_proxy
export rsync_proxy=$http_proxy
To comment them out just add # in front of each of the lines. Then restart your terminal session.
Side Note:
When you type user$ arc from the terminal you will want to make sure you have appium running and the appium.txt file in the same directory where your running arc.
Lots of good stuff here -> Ruby_Console
I hope that helps you or someone else.

Error: migrate SQLite to Postgres

I developed my app with the standard configuration (SQLite 3). I want do deploy on heroku and have to change to postgresql.
But I get this error, when trying to migrate my db-schema.
rake db:migrate
rake aborted!
/Users/adrianschnell/Sites/bills_cmd/config/initializers/session_store.rb:3: syntax error, unexpected ':', expecting $end
...sion_store :cookie_store, key: '_bills_cmd_session'
^
/Library/Ruby/Gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in `load'
/Library/Ruby/Gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in `load'
/Library/Ruby/Gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
/Library/Ruby/Gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in `load'
/Library/Ruby/Gems/1.8/gems/railties-3.2.11/lib/rails/engine.rb:588
/Library/Ruby/Gems/1.8/gems/railties-3.2.11/lib/rails/engine.rb:587:in `each'
/Library/Ruby/Gems/1.8/gems/railties-3.2.11/lib/rails/engine.rb:587
/Library/Ruby/Gems/1.8/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `instance_exec'
/Library/Ruby/Gems/1.8/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `run'
/Library/Ruby/Gems/1.8/gems/railties-3.2.11/lib/rails/initializable.rb:55:in `run_initializers'
/Library/Ruby/Gems/1.8/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `each'
/Library/Ruby/Gems/1.8/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `run_initializers'
/Library/Ruby/Gems/1.8/gems/railties-3.2.11/lib/rails/application.rb:136:in `initialize!'
/Library/Ruby/Gems/1.8/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `send'
/Library/Ruby/Gems/1.8/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/adrianschnell/Sites/bills_cmd/config/environment.rb:8
/Library/Ruby/Gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
/Library/Ruby/Gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
/Library/Ruby/Gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
/Library/Ruby/Gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
/Library/Ruby/Gems/1.8/gems/railties-3.2.11/lib/rails/application.rb:103:in `require_environment!'
/Library/Ruby/Gems/1.8/gems/railties-3.2.11/lib/rails/application.rb:297:in `initialize_tasks'
Tasks: TOP => db:migrate => environment
I don't know what i have to do now.
My Gem File has included 'pg' and my database.yml looks like:
# PostgreSQL v0.8.x
# gem install pg
development:
adapter: postgresql
encoding: unicode
database: bills_cmd_dev
pool: 5
username: adrianschnell
password:
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: postgresql
encoding: unicode
database: bills_cmd_test
pool: 5
username: adrianschnell
password:
PostgreSQL is running - via terminal i can access it.
EDIT:
I noticed, that I get the following error when trying to create the postgre db:
rake db:create:all
rake aborted!
syntax error on line 18, col 11: `'
/Library/Ruby/Gems/1.8/gems/railties-3.2.11/lib/rails/application/configuration.rb:115:in `database_configuration'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.11/lib/active_record/railties/databases.rake:25
Tasks: TOP => db:create:all => db:load_config
(See full trace by running task with --trace)
after hours of searching and testing different suggestions, I tried the ones here: stackoverflow
especially the entry of Darren was the solution for me. Now my RoR App is running with postgre.

Impossible to use rake in my rails project

Every time I try to use rake in my rails project it throw me the message below. I tried to re-install ruby, rails, rake, re-create the project, launch my rake db:migrate with sudo but nothing seems to work...
I created the object via the scaffold command:
rails generate scaffold User nom:string email:string
After this command execute succesfully, i launch
rake db:migrate
And it return this message:
rake aborted!
GONE
/var/lib/gems/1.9.1/gems/railties-3.0.5/lib/rails/tasks/documentation.rake:1:in `require'
/var/lib/gems/1.9.1/gems/railties-3.0.5/lib/rails/tasks/documentation.rake:1:in `<top (required)>'
/var/lib/gems/1.9.1/gems/railties-3.0.5/lib/rails/tasks.rb:15:in `load'
/var/lib/gems/1.9.1/gems/railties-3.0.5/lib/rails/tasks.rb:15:in `block in <top (required)>'
/var/lib/gems/1.9.1/gems/railties-3.0.5/lib/rails/tasks.rb:6:in `each'
/var/lib/gems/1.9.1/gems/railties-3.0.5/lib/rails/tasks.rb:6:in `<top (required)>'
/var/lib/gems/1.9.1/gems/railties-3.0.5/lib/rails/application.rb:213:in `require'
/var/lib/gems/1.9.1/gems/railties-3.0.5/lib/rails/application.rb:213:in `initialize_tasks'
/var/lib/gems/1.9.1/gems/railties-3.0.5/lib/rails/application.rb:139:in `load_tasks'
/var/lib/gems/1.9.1/gems/railties-3.0.5/lib/rails/application.rb:77:in `method_missing'
/home/bassochette/Dev/rails/tuto/demo_app/Rakefile:7:in `<top (required)>'
(See full trace by running task with --trace)
ps: I'm new to rails and in the learning phase.

Rails server not starting. Gems all installed, I'm confused

I went to restart my rails server today and when I went to fire it back up here's the error I got. I've tried everything and haven't been able to crack it. I uninstalled and reinstalled activesupport 3.1.0, and it seems like there's an error in activesupport itself, which I doubt I can fix. So, color me confused (paint me perplexed). Any advice much appreciated.
$ RESQUE_INTERFACE=true rails s
=> Booting WEBrick
=> Rails 3.1.0 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Library/Ruby/Gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:234:in `load': /Users/nickgoddard/codebase/newshop/config/initializers/session_store.rb:3: syntax error, unexpected ':', expecting $end (SyntaxError)
...sion_store :cookie_store, key: '_newshop_session'
^
from /Library/Ruby/Gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:234:in `load'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:in `new_constants_in'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:234:in `load'
from /Library/Ruby/Gems/1.8/gems/railties-3.1.0/lib/rails/engine.rb:555
from /Library/Ruby/Gems/1.8/gems/railties-3.1.0/lib/rails/engine.rb:554:in `each'
from /Library/Ruby/Gems/1.8/gems/railties-3.1.0/lib/rails/engine.rb:554
from /Library/Ruby/Gems/1.8/gems/railties-3.1.0/lib/rails/initializable.rb:25:in `instance_exec'
from /Library/Ruby/Gems/1.8/gems/railties-3.1.0/lib/rails/initializable.rb:25:in `run'
from /Library/Ruby/Gems/1.8/gems/railties-3.1.0/lib/rails/initializable.rb:50:in `run_initializers'
from /Library/Ruby/Gems/1.8/gems/railties-3.1.0/lib/rails/initializable.rb:49:in `each'
from /Library/Ruby/Gems/1.8/gems/railties-3.1.0/lib/rails/initializable.rb:49:in `run_initializers'
from /Library/Ruby/Gems/1.8/gems/railties-3.1.0/lib/rails/application.rb:92:in `initialize!'
from /Library/Ruby/Gems/1.8/gems/railties-3.1.0/lib/rails/railtie/configurable.rb:30:in `send'
from /Library/Ruby/Gems/1.8/gems/railties-3.1.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/nickgoddard/codebase/newshop/config/environment.rb:5
from /Library/Ruby/Gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:in `new_constants_in'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
from /Users/nickgoddard/codebase/newshop/config.ru:4
from /Library/Ruby/Gems/1.8/gems/rack-1.3.6/lib/rack/builder.rb:51:in `instance_eval'
from /Library/Ruby/Gems/1.8/gems/rack-1.3.6/lib/rack/builder.rb:51:in `initialize'
from /Users/nickgoddard/codebase/newshop/config.ru:1:in `new'
from /Users/nickgoddard/codebase/newshop/config.ru:1
You're trying to run Ruby 1.9 code on Ruby 1.8, specifically the session_store hash parameters.
Usually, when you create a new Rails app, it should know this, but I'm not sure of the specifics about how you set up your app (or maybe you cloned someone else's?). To create an app and force it to use the 1.8 style of hashes, do:
rails new my_app --old-style-hash
Or, you can use something like rvm or rbenv to install Ruby 1.9 and use that instead.

Why is my development server not loading? default_controller_and_action': missing :action (ArgumentError)

I'm a Ruby nuby (and new to Stack Overflow) working on the Rails Tutorial by Michael Hartl and all of a sudden my development server won't load and keeps exiting. Console also won't load and Rspec spec/ produces errors/exceptions. I am including some output from the terminal, your help is much appreciated.
Exiting
/Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/actionpack-3.0.3/lib/action_dispatch/routing/mapper.rb:164:in `default_controller_and_action': missing :action (ArgumentError)
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/actionpack-3.0.3/lib/action_dispatch/routing/mapper.rb:68:in `normalize_options!'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/actionpack-3.0.3/lib/action_dispatch/routing/mapper.rb:51:in `initialize'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/actionpack-3.0.3/lib/action_dispatch/routing/mapper.rb:261:in `new'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/actionpack-3.0.3/lib/action_dispatch/routing/mapper.rb:261:in `match'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/actionpack-3.0.3/lib/action_dispatch/routing/mapper.rb:1112:in `match'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/actionpack-3.0.3/lib/action_dispatch/routing/mapper.rb:1297:in `match'
from /Users/ameedachowdhury/rails_projects/railstutorial/config/routes.rb:11:in `block in <top (required)>'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/actionpack-3.0.3/lib/action_dispatch/routing/route_set.rb:233:in `instance_exec'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/actionpack-3.0.3/lib/action_dispatch/routing/route_set.rb:233:in `draw'
from /Users/ameedachowdhury/rails_projects/railstutorial/config/routes.rb:1:in `<top (required)>'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:235:in `load'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:235:in `block in load'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `block in load_dependency'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:235:in `load'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/railties-3.0.3/lib/rails/application.rb:127:in `block in reload_routes!'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/railties-3.0.3/lib/rails/application.rb:127:in `each'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/railties-3.0.3/lib/rails/application.rb:127:in `reload_routes!'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/railties-3.0.3/lib/rails/application.rb:120:in `block in routes_reloader'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/activesupport-3.0.3/lib/active_support/file_update_checker.rb:32:in `call'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/activesupport-3.0.3/lib/active_support/file_update_checker.rb:32:in `execute_if_updated'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/railties-3.0.3/lib/rails/application/finisher.rb:51:in `block (2 levels) in <module:Finisher>'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/railties-3.0.3/lib/rails/application/finisher.rb:52:in `call'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/railties-3.0.3/lib/rails/application/finisher.rb:52:in `block in <module:Finisher>'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `instance_exec'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `run'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/railties-3.0.3/lib/rails/initializable.rb:50:in `block in run_initializers'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `each'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `run_initializers'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/railties-3.0.3/lib/rails/application.rb:134:in `initialize!'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/railties-3.0.3/lib/rails/application.rb:77:in `method_missing'
from /Users/ameedachowdhury/rails_projects/railstutorial/config/environment.rb:5:in `<top (required)>'
from /Users/ameedachowdhury/rails_projects/railstutorial/config.ru:3:in `require'
from /Users/ameedachowdhury/rails_projects/railstutorial/config.ru:3:in `block in <main>'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize'
from /Users/ameedachowdhury/rails_projects/railstutorial/config.ru:1:in `new'
from /Users/ameedachowdhury/rails_projects/railstutorial/config.ru:1:in `<main>'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/rack-1.2.1/lib/rack/builder.rb:35:in `eval'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/rack-1.2.1/lib/rack/builder.rb:35:in `parse_file'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/rack-1.2.1/lib/rack/server.rb:162:in `app'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/rack-1.2.1/lib/rack/server.rb:248:in `wrapped_app'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/rack-1.2.1/lib/rack/server.rb:213:in `start'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/railties-3.0.3/lib/rails/commands/server.rb:65:in `start'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/railties-3.0.3/lib/rails/commands.rb:30:in `block in <top (required)>'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/railties-3.0.3/lib/rails/commands.rb:27:in `tap'
from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/gems/railties-3.0.3/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
ameeda-chowdhurys-macbook:railstutorial ameedachowdhury$
When I ran into this problem, it was because one of the routes in routes.rb had a slash (/) instead of the hash (#) when using the controller#action syntax (I used "controller/action", which was incorrect).
For example, I accidentally had root :to => 'home/index'. It was supposed to be root :to => 'home#index'.
I found this solution in here.
This is caused by incorrect routes -
Please check your config/routes.rb , even if one route mentioned is wrong then this error is thrown !!
Also make sure that the route is
'/url/for/something' => 'controller#action'
or
root :to => 'controller#action
I'm also a Ruby nuby and had the same error while working on the Rails Tutorial by Michael Hartl. If you're like me, you might be just typing in all code that appears in the book with really reading or understanding the text. Not everything is step by step. In demonstrating camel case vs. snake case Hartl shows a box with the following code
$ rails generate controller static_pages ...
Here, Hartl is simply trying to contrast instructions to generate a StaticPages controller using snake case, rather than camel case, which was done in Listing 3.4. The dots "..." are simply to edit out or truncate the rest of the instructions for the cmd line. I typed in exactly what was shown and wound up with the following in my routes file:
SampleApp::Application.routes.draw do
get "static_pages/..."
get "static_pages/home"
get "static_pages/help"
open up your routes file, delete
get "static_pages/..."
save the routes file, and try starting rails server again.
I also destroyed "rails generate controller static_pages ..." Not sure if that had any effect, but now everything works.
By default you get this:
Rails.application.routes.draw do
get 'static_pages/...'
get 'static_pages/home'
get 'static_pages/help'
JUST ERASE THIS:
get 'static_pages/...'
AND YOU WILL HAVE THIS IN THE ROUTES.RB FILE
Rails.application.routes.draw do
get 'static_pages/home'
get 'static_pages/help'
In my case it was caused by the suffix slash '/' in some of my routes. E.g.
post 'load_query/'
After removing this suffix to
post 'load_query'
it worked.
change your default root in the routes.rb file.
get "static_pages#home" TO root to: 'static_pages#home'
I've gone through the same issue, and the above change worked for me.