Ruby on Rails Saturday, October 2, 2010

On 10-10-02 05:09 PM, pauld wrote:
> Just starting out with RoR3, and have tried to render first page.
>
> Here is code for hello_controller.rb
>
>
> class HelloController< ApplicationController
> def world
> render :text => "<h1>Hello world!</h1>"
> end
> end
>
> Did not make any changes to the routes.rb file. When I went to
> http://localhost:3000/hello/world I got the following error:
>
> ActionController::RoutingError (No route matches "/hello/world"):
>
> Do I need to make changes to the routes.rb file? If so, what changes?
>
> Thank you.
>

first follow the MVC convention of writing correct rails code, put view
code in the views. get out of the habit now to write view code in the
controller, the controller should be kept lean and mean as possible

try putting the following line in routes.rb

get 'hello/world'

--
Kind Regards,
Rajinder Yadav

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment