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 <html> <head> <title>Hello, Rails!</title> </head> <body> <h1>Hello from Rails!</h1> </body> </html> Browse to locahost:3000/say/hello gives the error Routing Error No route matches "/say/hello.html.erb" Amrit pal -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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 <html> <head> <title>Hello, Rails!</title> </head> <body> <h1>Hello from Rails!</h1> </body> </html> Browse to locahost:3000/say/hello gives the error Routing Error No route matches "/say/hello.html.erb" Amrit pal -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Please somebody help me. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
It looks like you were trying to access "/say/hello.html.erb" as the URL rather than "say/hello" -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 26 Apr 2011, at 10:51, amrit pal pathak <amritpalpathak1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Generated a controller "rails generate controller say" and then added > a method to id named hello as.You need to add a route to the action. Colin discussed this with you at some length last week. Fred> def hello > end > Made a file /app/view/say/hello.html.erb > as "sudo gedit hello.html.erb" and add follwoing to it > > <html> > <head> > <title>Hello, Rails!</title> > </head> > <body> > <h1>Hello from Rails!</h1> > </body> > </html> > > Browse to locahost:3000/say/hello gives > the error > Routing Error > No route matches "/say/hello.html.erb" > > > Amrit pal > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Apr 26, 7:54 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 26 Apr 2011, at 10:51, amrit pal pathak <amritpalpath...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Generated a controller "rails generate controller say" and then added > > a method to id named hello as. > > You need to add a route to the action. Colin discussed this with you at some length last week.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? Thanks -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
On 26 April 2011 13:22, amrit pal pathak <amritpalpathak1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On Apr 26, 7:54 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: >> On 26 Apr 2011, at 10:51, amrit pal pathak <amritpalpath...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> > Generated a controller "rails generate controller say" and then added >> > a method to id named hello as. >> >> You need to add a route to the action. Colin discussed this with you at some length last week. > 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.Yes it does. Go and read the Rails Guide on routing again. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
On Apr 26, 8:31 am, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 26 April 2011 13:22, amrit pal pathak <amritpalpath...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > On Apr 26, 7:54 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > wrote: > >> On 26 Apr 2011, at 10:51, amrit pal pathak <amritpalpath...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > >> > Generated a controller "rails generate controller say" and then added > >> > a method to id named hello as. > > >> You need to add a route to the action. Colin discussed this with you at some length last week. > > 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. > > Yes it does. Go and read the Rails Guide on routing again.ok .Done " root :to => "say#hello"". Still unsussess. No route matches "/say/hello" Thank you. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
> amritpal p. wrote in post #995099: > > 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: http://railscasts.com/episodes/231-routing-walkthrough http://railscasts.com/episodes/232-routing-walkthrough-part-2 -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Apr 26, 9:26 am, Pale Horse <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> > amritpal p. wrote in post #995099: > > > 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?it said " No route matches "/say/hello"". Thanks -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
> amritpal p. wrote in post #995108: > >> On Apr 26, 9:26am, Pale Horse <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> 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 > >> What happens if you match ''say'', :to => ''say#hello'' and navigate your >> browser to /say? > > it said " No route matches "/say/hello"". > ThanksPlease paste your routes.rb file here or use http://pastie.org/ if it''s too long. -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Apr 26, 10:01 am, Pale Horse <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> > amritpal p. wrote in post #995108: > > >> On Apr 26, 9:26am, Pale Horse <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > >> 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 > > >> What happens if you match ''say'', :to => ''say#hello'' and navigate your > >> browser to /say? > > > it said " No route matches "/say/hello"". > > Thanks > > Please paste your routes.rb file here or usehttp://pastie.org/if it''s > too long.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) # Sample resource route (maps HTTP verbs to controller actions automatically): # resources :products # Sample resource route with options: # resources :products do # member do # get ''short'' # post ''toggle'' # end # # collection do # get ''sold'' # end # end # Sample resource route with sub-resources: # resources :products do # resources :comments, :sales # resource :seller # end # Sample resource route with more complex sub-resources # resources :products do # resources :comments # resources :sales do # get ''recent'', :on => :collection # end # end # Sample resource route within a namespace: # namespace :admin do # # Directs /admin/products/* to Admin::ProductsController # # (app/controllers/admin/products_controller.rb) # resources :products # end # You can have the root of your site routed with "root" # just remember to delete public/index.html. root :to => "say#hello" # See how all your routes lay out with "rake routes" # This is a legacy wild controller route that''s not recommended for RESTful applications. # Note: This route will make all actions in every controller accessible via GET requests. # match '':controller(/:action(/:id(.:format)))'' end Amrit pal -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
> amritpal p. wrote in post #995117: > >> Please paste your routes.rb file here or use http://pastie.org/ if it''s >> too long. > > Age::Application.routes.draw do > root :to => "say#hello" > # See how all your routes lay out with "rake routes" > end > > Amrit palWhat is the output of rake routes? This will show you "how all your routes lay out". -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
> amritpal p. wrote in post #995070: > 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 > > <html> > <head> > <title>Hello, Rails!</title> > </head> > <body> > <h1>Hello from Rails!</h1> > </body> > </html> > > Browse to locahost:3000/say/hello gives > the error > Routing Error > No route matches "/say/hello.html.erb" > > Amrit palYou need to add the route to config/routes.rb so that your application knows how to match the URL to a given controller/action pair or use a more vague route definition: match '':controller(/:action(/:id))'' That way, any requests for /say will match this route unless any more specific matching routes are found earlier in the file. Also, please use a layout file for your HTML tags so that you don''t have to use <head> and <body> tag definitions in *every* view in order to pass w3c validation. -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Apr 26, 12:09 pm, Pale Horse <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> > amritpal p. wrote in post #995070: > > 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 > > > <html> > > <head> > > <title>Hello, Rails!</title> > > </head> > > <body> > > <h1>Hello from Rails!</h1> > > </body> > > </html> > > > Browse to locahost:3000/say/hello gives > > the error > > Routing Error > > No route matches "/say/hello.html.erb" > > > Amrit pal > > You need to add the route to config/routes.rb so that your application > knows how to match the URL to a given controller/action pair or use a > more vague route definition: > > match '':controller(/:action(/:id))'' > > That way, any requests for /say will match this route unless any more > specific matching routes are found earlier in the file. > > Also, please use a layout file for your HTML tags so that you don''t have > to use <head> and <body> tag definitions in *every* view in order to > pass w3c validation.ok Thanks -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
very strange again !! say_controller.rb looks like: class SayController < ApplicationController def hello @timee =Time.now end def goodbye end end /app/view/say/hello.html.erb looks like: It is now <%= @timee%> <a href="/say/goodbye">Goodbye</a> /app/view/say/goodbye.html.erb looks like: <h1>Good bye buddy!</h1> When i click on Goodbye link given in hello.html.erb file it says "No route matches "/say/goodbye" .It made me desperate.i dont know what this error persist. Please guide. Thanks -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
> amritpal p. wrote in post #995323: > > class SayController < ApplicationController > def hello > @timee = Time.now > end > def goodbye > > end > end > > /app/views/say/hello.html.erb looks like: > > It is now <%= @timee %> > <a href="/say/goodbye">Goodbye</a>Instead of <a href="/say/goodbye">Goodbye</a>, use <%= link_to "Goodbye", :action => "goodbye" %>> /app/views/say/goodbye.html.erb looks like: > > <h1>Good bye buddy!</h1> > > When i click on Goodbye link given in hello.html.erb file it says > "No route matches "/say/goodbye". It made me desperate. I don''t > know why this error persists.Have you set up a route for it in config/routes.rb? -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Apr 27, 10:52 am, Pale Horse <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> > amritpal p. wrote in post #995323: > > > class SayController < ApplicationController > > def hello > > @timee = Time.now > > end > > def goodbye > > > end > > end > > > /app/views/say/hello.html.erb looks like: > > > It is now <%= @timee %> > > <a href="/say/goodbye">Goodbye</a> > > Instead of <a href="/say/goodbye">Goodbye</a>, use <%= link_to > "Goodbye", :action => "goodbye" %>It didn''t help,error says No route matches {:controller=>"say", :action=>"goodbye"}> > > /app/views/say/goodbye.html.erb looks like: > > > <h1>Good bye buddy!</h1> > > > When i click on Goodbye link given in hello.html.erb file it says > > "No route matches "/say/goodbye". It made me desperate. I don''t > > know why this error persists. > > Have you set up a route for it in config/routes.rb?yes is set up as: root :to => "say#hello" Thanks -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
On 28 April 2011 02:37, amrit pal pathak <amritpalpathak1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On Apr 27, 10:52 am, Pale Horse <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> > amritpal p. wrote in post #995323: >> >> > class SayController < ApplicationController >> > def hello >> > @timee = Time.now >> > end >> > def goodbye >> >> > end >> > end >> >> > /app/views/say/hello.html.erb looks like: >> >> > It is now <%= @timee %> >> > <a href="/say/goodbye">Goodbye</a> >> >> Instead of <a href="/say/goodbye">Goodbye</a>, use <%= link_to >> "Goodbye", :action => "goodbye" %> > It didn''t help,error says > No route matches {:controller=>"say", :action=>"goodbye"} >> >> > /app/views/say/goodbye.html.erb looks like: >> >> > <h1>Good bye buddy!</h1> >> >> > When i click on Goodbye link given in hello.html.erb file it says >> > "No route matches "/say/goodbye". It made me desperate. I don''t >> > know why this error persists. >> >> Have you set up a route for it in config/routes.rb? > yes is set up as: > > root :to => "say#hello"So you think that the above line, which says route ''/'' to say#hello'' is going to route /say/goodbye somewhere? As I said previously you need to re-read the Rails Guide on routing. Read every line and make sure you understand it. If you think you already understand it then you are mistaken. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
> amritpal p. wrote in post #995439: > >> Instead of <a href="/say/goodbye">Goodbye</a>, use <%= link_to >> "Goodbye", :action => "goodbye" %> > > It didn''t help, error says: > No route matches {:controller=>"say", :action=>"goodbye"}Of course it didn''t, but you are working in a Rails environment so you ought to be using Rails conventions and helpers like ''link_to''.>>> /app/views/say/goodbye.html.erb looks like: >> >>> <h1>Good bye buddy!</h1> >> >>> When I click on Goodbye link given in hello.html.erb file it says >>> "No route matches "/say/goodbye". It made me desperate. I don''t >>> know why this error persists. >> >> Have you set up a route for it in config/routes.rb? > > Yes is set up as: > root :to => "say#hello" > ThanksI think you need to take Colin''s advice - once you''re *absolutely* confident you understand the fundamentals of routing in Rails 3, you need to check the setup of your Rails environment against a working example, maybe by searching online or using one of your working applications (if you have one). -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Apr 28, 3:25 am, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 28 April 2011 02:37, amrit pal pathak <amritpalpath...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > > On Apr 27, 10:52 am, Pale Horse <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > >> > amritpal p. wrote in post #995323: > > >> > class SayController < ApplicationController > >> > def hello > >> > @timee = Time.now > >> > end > >> > def goodbye > > >> > end > >> > end > > >> > /app/views/say/hello.html.erb looks like: > > >> > It is now <%= @timee %> > >> > <a href="/say/goodbye">Goodbye</a> > > >> Instead of <a href="/say/goodbye">Goodbye</a>, use <%= link_to > >> "Goodbye", :action => "goodbye" %> > > It didn''t help,error says > > No route matches {:controller=>"say", :action=>"goodbye"} > > >> > /app/views/say/goodbye.html.erb looks like: > > >> > <h1>Good bye buddy!</h1> > > >> > When i click on Goodbye link given in hello.html.erb file it says > >> > "No route matches "/say/goodbye". It made me desperate. I don''t > >> > know why this error persists. > > >> Have you set up a route for it in config/routes.rb? > > yes is set up as: > > > root :to => "say#hello" > > So you think that the above line, which says route ''/'' to say#hello'' > is going to route /say/goodbye somewhere?No it will not route to /say/goodbye,but it will route to /say/ hello which has a link to /say/goodbye method. Can you tell me solution? Thanks As I said previously you> need to re-read the Rails Guide on routing. Read every line and make > sure you understand it. If you think you already understand it then > you are mistaken. > > Colin-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
amritpal p. wrote in post #995520:> On Apr 28, 3:25am, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> >> > root :to => "say#hello" >> >> So you think that the above line, which says route ''/'' to say#hello'' >> is going to route /say/goodbye somewhere?> No it will not route to /say/goodbye,but it will route to /say/ > hello which has a link to /say/goodbye method.Umm... no it won''t, as evidenced by your own statement:> When i click on Goodbye link given in hello.html.erb file it says > "No route matches "/say/goodbye".Take a look at your log file and see what your Rails application is receiving when you click the "Goodbye" link in the browser. Review your routes.rb file. If you run a rake routes > routes.lst then look at the routes.lst file, you''ll know exactly what routes you have available in your application. Next, re-read the Rails guide on routing. I hesitate to just say "type this code in here and it will work" because that doesn''t lead to learning or understanding. Directing you to look at your log file to see what your application is receiving, seeing what Rails has as routes for your application, and pointing to the correct reference for reading may. It''s the old "give a man a fish..." strategy. -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.