0
votes

I'm using RailsSpace to learn Ruby on Rails and am coming across an error after performing what seems like a simple command.

I used the Terminal to generate a new User controller with the views Index and Register:

$ rails generate controller User index register

And it had no problem with that, creating the files index.html.erb and register.html.erb as well as all the other expected files.

But when I visit http://localhost:3000/user/register, it comes back with the error message:

ROUTING ERROR: No route matches {:controller=>"user", :action=>"about"}

My routes.rb doesn't indicate any abnormalities:

RailsSpace::Application.routes.draw do
  get "user/index"

  get "user/register"

  get "site/index"

  get "site/about"

  get "site/help"

  root :to => "site#index"

end

Why does it try to route to the "About" action, and what other file can I edit to change this routing?

I'm using Rails 3 in case that matters.

1
looks like somewhere in you views (layouts/application.html.erb or user/register.html.erb) there is a link_to with this route: {:action=>"about"}, and rails uses current controller (user) to create the route. Is there such a link anywhere?alony
It's been a while so, as I always do, I wonder what happened with this. I can't really say much without knowing what happens in the controller code for user/register. It wouldn't happen to do a re-direct to user/about, would it? Also, there is apparently a route for site/about. Is it possible that's where things were supposed to go, but there was a typo in the tutorial that sent it to user/about instead?irrational John

1 Answers

0
votes

I would try hand coding in the route. In your case it would look like this:

match '/user/register' => 'users#register', :as => :register

This will definitely work and prevent the page /user/register from going to the about page. Let me know how things go and Ill try to continue to steer you in the right direction.