0

I've created controllers in the past successfully, but all of a sudden I'm getting a weird error. I'm doing this:

ruby script/generate controller Request

And am getting this error message:

/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/routing/builder.rb:175:in `build': Illegal route: the :controller must be specified! (ArgumentError)
    from /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:309:in `add_route'
    from /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:317:in `add_named_route'
    from /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:57:in `method_missing'
    from /Users/ben/rails_projects/talk/config/routes.rb:55
    from /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:226:in `draw'
    from /Users/ben/rails_projects/talk/config/routes.rb:1
    from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in `load_without_new_constant_marking'
    from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in `load'
    from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
    from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in `load'
    from /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:286:in `load_routes!'
    from /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:286:in `each'
    from /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:286:in `load_routes!'
    from /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:266:in `reload!'
    from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:537:in `initialize_routing'
    from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:188:in `process'
    from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `send'
    from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `run'
    from /Users/ben/rails_projects/talk/config/environment.rb:9
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/commands/generate.rb:1
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'

Any ideas on how to fix this? Thanks for reading.

2
  • i notice your routes.rb page listed in the trace--anything in there that looks suspicious? Commented Jun 27, 2010 at 6:03
  • This was it! I somehow missed a half finished line of code in routes.rb, which was causing the problem. Thanks! If you submit an answer I'll mark it as correct Commented Jun 27, 2010 at 6:09

2 Answers 2

1

I'm not sure what it is, but something in your routes.rb seems to be causing the error

Sign up to request clarification or add additional context in comments.

Comments

1

I believe Request is a reserved word and so you can use it as the controller's name.

Have you tried generating another controller with another name to see if the same error occurs?

3 Comments

Yeah I tried it with some other names and the same error happened.
oh, really, I can generate the Request controller.
I've fixed the problem, but I think it might be a good idea to not use Request anyway. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.