Search code examples
ruby-on-railsruby-on-rails-4aptana3

Route error in rails demo app


I have created a simple hello world application in Rails (4.1.4) in Aptana Studio 3.

The problem is whenever I am running the server and try to access localhost:3000, everything is fine but when I try to access the application with localhost:3000/greet/index, I get the following error message :

Routing Error

No route matches [GET] "/greet/index"

Rails.root: D:/WorkSpace/demo_rails

Application Trace | Framework Trace | Full Trace Routes

Routes match in priority from top to bottom

You don't have any routes defined!

Please add some routes in config/routes.rb. For more information about routes, please see the Rails guide Rails Routing from the Outside In.

Helper HTTP Verb Path Controller#Action Path / Url


Solution

    1. Read error message. It says you do not have any routes. Open the recommended in error message materials and read those.

    2. add root to: 'greet#index' to routes.


    Recommendation: always check error message carefully, Rails are smart enough to provide you with fully helpful hints in those.