Help needed - No route matches [GET] "/draw/load"

Hi All,

I am new to Rails. I installed rails 3.2.13. Have Ruby ver. 1.9.2p20. I created a very simple rails example as follows.

1. Created rails app called "chart" 2. Generated a controller called - "draw" that has the following lines of code. It has a action called "load" which has no code in it. class DrawController < ApplicationController   def load   end end 3. I then navigated to following directory to create a view template of extension - .rhtml C:\rails\chart\app\views\draw\ 4. I start Webrick and hit URL - "http://localhost:3000/draw/load&quot;

I get the following error: No route matches [GET] "/draw/load" Try running rake routes for more information on available routes.

The above example is most basic i suppose and should work. The .rhtml page just has plain html.

Can someone please tell me what could be the issue. I remember this worked fine with previous rails version. Has anything changed?

Help much appreciated.

You need to configure the route in the config/routes.db file. In this case,

get ‘draw#load’

mike wrote in post #1109637:

Recommended reading: Rails Routing from the Outside In — Ruby on Rails Guides

And all the other guides in fact, there are a number of changes since Rails 2. It might be worth skimming through the tutorial at railstutorial.org (which is free to use online) to see how much has changed.

Colin

Rochit Sen wrote in post #1109638:

mike wrote in post #1109637:

  def load

You need to configure the route in the config/routes.db file. In this case,

get 'draw#load'

Hi Mike. Thanks for response. So in this case i would need to do addition in Routes.rb for each controller/action.? Is there no rule that can be set In routes.rb?

Hi All,

I looked at the guide and also entered: get 'draw#load' This is still not working. Can someone please send me a working example or try similar thing themselves. I am really stuck on this.

thanks

Maybe try:

    match 'draw/load' => 'draw#load'

instead?

I missed something in your original post. The above match statement should work with 3.2 for routing, but your view file needs to end in html.erb for embedded ruby, or haml. rhtml isn’t recognized. I also echo Colin’s post, there’s a lot that has changed with Rails and spending some time with a decent tutorial and/or the edge guides would ease the transition considerably.

mike wrote in post #1109705: