[newbi] Problem Routes


#1

Hello,

i try to follow this video

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 #

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:inconst_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


#2

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 #

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:inconst_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


#3

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:inconstantize’
/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:inpaginator_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:inlist’
#{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


#4

Bolo M. wrote:

and deleted index.html. I launch my browser

http://localhost:3000/

i have this error message
NameError in #

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:inconst_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