Monday, September 17, 2012

missing :controller ( ArgumentError), Ruby


C:\work\BackChannel>rails destroy Category
C:/work/BackChannel/builder/ruby/1.9.1/gems/actionpack-3.2.1/lib/action_dispatch
/routing/mapper.rb:179:in `default_controller_and_action': missing :controller (
ArgumentError)
        from C:/work/BackChannel/builder/ruby/1.9.1/gems/actionpack-3.2.1/lib/ac
tion_dispatch/routing/mapper.rb:76:in `normalize_options!'
        from C:/work/BackChannel/builder/ruby/1.9.1/gems/actionpack-3.2.1/lib/ac
tion_dispatch/routing/mapper.rb:59:in `initialize'
        from C:/work/BackChannel/builder/ruby/1.9.1/gems/actionpack-3.2.1/lib/ac
tion_dispatch/routing/mapper.rb:1302:in `new'

I was having this error while running either a destroy command or scaffold to create new category. Later I realized it was because of some existing routes present in routes for Category model. After removing them command worked successfully. In order to debug such error track the stacktrace of error and find any file which is part of your project. I mean not the ruby code base file.



No comments:

Post a Comment