This project is archived and is in readonly mode.
troubles with script/generate for controller
Reported by mrbernz | June 30th, 2010 @ 12:05 PM
I tried generating a controller using the generate script and I get the following strange error message. I tried searching the web and I can't seem to find an answer.
mrbernz:mylife bernardleung$ ruby script/generate controller
Pages index show new create edit update destroy
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/routing/builder.rb:159:in
build': undefined method
[]' for :pages:Symbol
(NoMethodError)
from /Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:310:in `add_route'
from /Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:19:in `connect'
from /Users/bernardleung/Documents/My Development/mylife/config/routes.rb:41
from /Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:227:in `draw'
from /Users/bernardleung/Documents/My Development/mylife/config/routes.rb:1
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:145:in `load_without_new_constant_marking'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:145:in `load'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:145:in `load'
from /Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:287:in `load_routes!'
from /Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:287:in `each'
from /Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:287:in `load_routes!'
from /Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:267:in `reload!'
from /Library/Ruby/Gems/1.8/gems/rails-2.3.8/lib/initializer.rb:537:in `initialize_routing'
from /Library/Ruby/Gems/1.8/gems/rails-2.3.8/lib/initializer.rb:188:in `process'
from /Library/Ruby/Gems/1.8/gems/rails-2.3.8/lib/initializer.rb:113:in `send'
from /Library/Ruby/Gems/1.8/gems/rails-2.3.8/lib/initializer.rb:113:in `run'
from /Users/bernardleung/Documents/My Development/mylife/config/environment.rb:9
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
from /Library/Ruby/Gems/1.8/gems/rails-2.3.8/lib/commands/generate.rb:1
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
from script/generate:3
I was able to generate the model using the generate script, just not the controller? I'm not sure what I'm doing wrong. I've updated my installation to the latest version of both Ruby and Rails.
Comments and changes to this ticket
-
José Valim June 30th, 2010 @ 12:10 PM
- State changed from new to invalid
- Importance changed from to Low
It seems you added an invalid route to your application. You probably won't be able to start your server and access a webpage as well. Try converting any :pages in your to a string as "pages".
-
mrbernz June 30th, 2010 @ 12:49 PM
Hi Jose,
Yes thanks for that, that worked perfectly! Much appreciated.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>