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"
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?
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.
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.
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.