Generated a controller "rails generate controller say" and then added
a method to id named hello as.
def hello
end
Made a file /app/view/say/hello.html.erb
as "sudo gedit hello.html.erb" and add follwoing to it
Yes he discussed ,but thats was only if i want to see hello
action at "localhost:3000". But to see hello method at "localhost:
3000/say/hello" doesn't need any routing settings.Still it is not
showing it
Why?
ok .Done
"root :to => "say#hello"". Still unsussess.
No route matches "/say/hello"
Thank you.
Quoted from the Rails guide: "You should put the root route at the end
of the file. You also need to delete the public/index.html.erb file for
the root route to take effect."
Rails will look in app/controllers for a controller named
'say_controller'. Inside that, it will search for an action with the
name 'hello' and then will render that action using hello.html.erb in
app/views/say
If it is not doing this, then there is something you've omitted when
trying to explain the issue.
What is the output of rake routes?
What happens if you match 'say', :to => 'say#hello' and navigate your
browser to /say?
Please see the following screencasts for routing in Rails 3.x:
> ok .Done
> "root :to => "say#hello"". Still unsussess.
> No route matches "/say/hello"
> Thank you.
Quoted from the Rails guide: "You should put the root route at the end
of the file. You also need to delete the public/index.html.erb file for
the root route to take effect."
it helped.but without deleting that file and setting routing
path to say controller "localhost:3000/say/hello" wasn't work?i think
it should work
Rails will look in app/controllers for a controller named
'say_controller'. Inside that, it will search for an action with the
name 'hello' and then will render that action using hello.html.erb in
app/views/say
If it is not doing this, then there is something you've omitted when
trying to explain the issue.
What is the output of rake routes?
What happens if you match 'say', :to => 'say#hello' and navigate your
browser to /say?
Age::Application.routes.draw do
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller
and :action
# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as
=> :purchase
# This route can be invoked with purchase_url(:id => product.id)