Forum: Ruby on Rails [newbi] Problem Routes

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bolo M. (Guest)
on 2006-04-03 19:34
(Received via mailing list)
Hello,

i try to follow this video
http://www.illanti.com/files/locomotive101.mov

After change my routes
routes.db
ActionController::Routing::Routes.draw do |map|
 # Add your own custom routes here.
 # The priority is based upon order of creation: first created ->
highest priority.

 # Here's a sample route:
 # map.connect 'products/:id', :controller => 'catalog', :action =>
'view'
 # Keep in mind you can assign values other than :controller and :action

 # You can have the root of your site routed by hooking up ''
 # -- just remember to delete public/index.html.
  map.connect '', :controller => 'notes'

 # Allow downloading Web Service WSDL as a file with an extension
 # instead of a file named 'wsdl'
 map.connect ':controller/service.wsdl', :action => 'wsdl'

 # Install the default route as the lowest priority.
 map.connect ':controller/:action/:id'
end


and deleted index.html. I launch my browser

http://localhost:3000/

i have this error message
NameError in <controller not set>#<action not set>

uninitialized constant NoteController
RAILS_ROOT:
/Users/bolomichelin/Documents/Creation_Perso/Developement/monApp/public/../config/..

Application Trace | Framework Trace | Full Trace
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:200:in
`const_missing'
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:72:in
`const_missing'
generated/routing/recognition.rb:4:in `recognize_path'
This error occured while loading the following files:
  note_controller.rb

Where is the problem ?

Bolo
Steve K. (Guest)
on 2006-04-03 21:42
Does your note_controller.rb have an "index" method? If it calls the
list action (as scaffoling generates), is your views/note/list.rhtml in
place? If not and you defined an index action of your own, do you have a
matching view?

If none of this sheds any light, try changing your route so that it
calls not just the controller but also a specific action that you know
works.

Bolo M. wrote:
> Hello,
>
> i try to follow this video
> http://www.illanti.com/files/locomotive101.mov
>
> After change my routes
> routes.db
> ActionController::Routing::Routes.draw do |map|
>  # Add your own custom routes here.
>  # The priority is based upon order of creation: first created ->
> highest priority.
>
>  # Here's a sample route:
>  # map.connect 'products/:id', :controller => 'catalog', :action =>
> 'view'
>  # Keep in mind you can assign values other than :controller and :action
>
>  # You can have the root of your site routed by hooking up ''
>  # -- just remember to delete public/index.html.
>   map.connect '', :controller => 'notes'
>
>  # Allow downloading Web Service WSDL as a file with an extension
>  # instead of a file named 'wsdl'
>  map.connect ':controller/service.wsdl', :action => 'wsdl'
>
>  # Install the default route as the lowest priority.
>  map.connect ':controller/:action/:id'
> end
>
>
> and deleted index.html. I launch my browser
>
> http://localhost:3000/
>
> i have this error message
> NameError in <controller not set>#<action not set>
>
> uninitialized constant NoteController
> RAILS_ROOT:
> /Users/bolomichelin/Documents/Creation_Perso/Developement/monApp/public/../config/..
>
> Application Trace | Framework Trace | Full Trace
> 
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:200:in
> `const_missing'
> 
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:72:in
> `const_missing'
> generated/routing/recognition.rb:4:in `recognize_path'
> This error occured while loading the following files:
>   note_controller.rb
>
> Where is the problem ?
>
> Bolo
Dj T@l (Guest)
on 2006-04-03 21:42
Bolo M. wrote:
> and deleted index.html. I launch my browser
>
> http://localhost:3000/
>
> i have this error message
> NameError in <controller not set>#<action not set>
>
> uninitialized constant NoteController
> RAILS_ROOT:
> /Users/bolomichelin/Documents/Creation_Perso/Developement/monApp/public/../config/..
>
> Application Trace | Framework Trace | Full Trace
> 
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:200:in
> `const_missing'
> 
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:72:in
> `const_missing'
> generated/routing/recognition.rb:4:in `recognize_path'
> This error occured while loading the following files:
>   note_controller.rb
>
> Where is the problem ?
>
> Bolo

What is the name of your controller ?
Did  http://localhost:3000/notes was ok ?
the name in the the  route.rb must be the same as the controller you
want to map. In this case , you must have a notes_controller.rb
Bolo M. (Guest)
on 2006-04-04 03:12
(Received via mailing list)
Hello,


> What is the name of your controller ?
i try this
 map.connect '', :controller => 'note'
and that
 map.connect '', :controller => 'notes'

> Did  http://localhost:3000/notes was ok ?
No it's not ok
NameError in Notes#index

uninitialized constant Note
RAILS_ROOT:
/Users/bolomichelin/Documents/Creation_Perso/Developement/monApp/public/../config/..

Application Trace | Framework Trace | Full Trace
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:200:in
`const_missing'
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/core_ext/string/../../inflector.rb:149:in
`constantize'
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/core_ext/string/inflections.rb:52:in
`constantize'
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/pagination.rb:186:in
`paginator_and_collection_for'
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/pagination.rb:124:in
`paginate'
#{RAILS_ROOT}/app/controllers/notes_controller.rb:8:in `list'
#{RAILS_ROOT}/app/controllers/notes_controller.rb:3:in `index'
This error occured while loading the following files:
   note.rb

> the name in the the  route.rb must be the same as the controller you
> want to map. In this case , you must have a notes_controller.rb`

yes i have this file.

Bolo
This topic is locked and can not be replied to.