Hi i created a controller article and added the following code
def chid
@message='hello world'
respond_to do |format|
format.html
end
end
I then created
chid.html.erbfile in
app/views/articles/
and wrote the following code
Hello world
When i gave the following url
../articles/chidi dunnot get any output.. am i missing something?
My log portion
Processing ArticlesController#show (for 127.0.0.1 at 2011-01-12 21:51:01)
[GET] Session ID: BAh7BzoMY3NyZl9pZCIlMTA0ZWY2ZTUzYjQxZGJkZmFlMTQwNWRjYjczNTRm%0AODAiCmZsYXNoSUM6J0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhh%0Ac2h7AAY6CkB1c2VkewA%3D--de7737601817f52c1b72daca6061c5126f3a5022
Parameters: {"action"=>"show", "id"=>"chid", "controller"=>"articles"}
Rendering template within layouts/articles
Rendering articles/show Completed in 0.01000 (100 reqs/sec) | Rendering: 0.00600 (60%) | DB: 0.00000 (0%) | 200 OK [localhost/articles/chid/]
my router.rb file is as follows
ActionController::Routing::Routes.draw do |map| map.resources :articles map.connect ':controller/:action/:id' map.connect ':controller/:action/:id.:format' map.match ':controller/:action/' => 'Article#chid' end
chidaction since it is not a CRUD operation. In this case, it is interpretingchidas theidof the article and attempting toshowon it. - Matheus Moreira