What is causing "undefined local variable or method `map' for main:Object (NameError)"

2,613 views
Skip to first unread message

pblen

unread,
Nov 14, 2009, 6:51:27 PM11/14/09
to ZiYa Plugin
What is causing the map method error when I test the 5 steps "Creating
a Ziya Chart in a Rails 2.3 application"?
This is the routes.rb contents.

map.load_chart '/blee/load_chart', :controller => 'blee', :action
=> 'load_chart'

Running on Mac 10.6.2
rails to 2.3.4
Gem 1.3.5
ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0]
derailed-ziya-2.1.5



I followed the instructions to the letter
http://groups.google.com/group/ziya-plugin/browse_thread/thread/b21dcaad79e9f275/5bc1b20f1b0c6772?lnk=gst&q=load_chart#5bc1b20f1b0c6772
&
http://ziya.liquidrail.com/docs/index.htmlWhat is causing the map
method error when I test the 5 steps "Creating a Ziya Chart in a Rails
2.3 application"?
This is the routes.rb contents.

map.load_chart '/blee/load_chart', :controller => 'blee', :action
=> 'load_chart'

Running on Mac 10.6.2
rails to 2.3.4
Gem 1.3.5
ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0]
derailed-ziya-2.1.5


Results

pb$ ./script/server
=> Booting Mongrel
=> Rails 2.3.4 application starting on http://0.0.0.0:3000
/Users/pb/Documents/source/rails_work/exchange/config/routes.rb:2:
undefined local variable or method `map' for main:Object (NameError)
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/
active_support/dependencies.rb:145:in
`load_without_new_constant_marking'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/
active_support/dependencies.rb:145:in `load'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/
active_support/dependencies.rb:521:in `new_constants_in'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/
active_support/dependencies.rb:145:in `load'
from /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/
action_controller/routing/route_set.rb:286:in `load_routes!'
from /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/
action_controller/routing/route_set.rb:286:in `each'
from /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/
action_controller/routing/route_set.rb:286:in `load_routes!'
from /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/
action_controller/routing/route_set.rb:266:in `reload!'
from /Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:
537:in `initialize_routing'
from /Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:
188:in `process'
from /Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:
113:in `send'
from /Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:
113:in `run'
from /Users/pblen/Documents/source/rails_work/exchange/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/activesupport-2.3.4/lib/
active_support/dependencies.rb:156:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/
active_support/dependencies.rb:521:in `new_constants_in'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/
active_support/dependencies.rb:156:in `require'
from /Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/commands/server.rb:
84
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/server:3

Thanks,
Philip

Fernand Galiana

unread,
Nov 16, 2009, 12:33:08 AM11/16/09
to ziya-...@googlegroups.com
Hi Philip,

  Hum - the line looks fine at first glance. What does line 1 looks like in your
routes.rb file. map should be a variable passed into the route block.

  So you should have a line 1 that looks something like this

  ActionController::Routing::Routes.draw do |map|

     map.load_chart '/blee/load_chart', :controller => 'blee', :action => 'load_chart'
  end

pblen

unread,
Nov 17, 2009, 9:33:15 AM11/17/09
to ZiYa Plugin
Copying your exact syntax moved me forward, to this error which
appeared in the browser?



NameError in BleeController#load_chart

uninitialized constant BleeController
RAILS_ROOT: /Users/pb/Documents/source/rails_work/exchange

Application Trace | Framework Trace | Full Trace
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/
dependencies.rb:443:in `load_missing_constant'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/
dependencies.rb:80:in `const_missing'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/
dependencies.rb:92:in `const_missing'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/
inflector.rb:361:in `constantize'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/
inflector.rb:360:in `each'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/
inflector.rb:360:in `constantize'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/
core_ext/string/inflections.rb:162:in `constantize'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/
routing/route_set.rb:443:in `recognize'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/
routing/route_set.rb:436:in `call

On Nov 14, 3:51 pm, pblen <blen.phi...@gmail.com> wrote:
> What is causing the map method error when I test the 5 steps "Creating
> a Ziya Chart in a Rails 2.3 application"?
> This is the routes.rb contents.
>
>      map.load_chart '/blee/load_chart', :controller => 'blee', :action
> => 'load_chart'
>
> Running on Mac 10.6.2
> rails to 2.3.4
> Gem 1.3.5
> ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0]
> derailed-ziya-2.1.5
>
> I followed the instructions to the letterhttp://groups.google.com/group/ziya-plugin/browse_thread/thread/b21dc...
> &http://ziya.liquidrail.com/docs/index.htmlWhatis causing the map
> method error when I test the 5 steps "Creating a Ziya Chart in a Rails
> 2.3 application"?
> This is the routes.rb contents.
>
>      map.load_chart '/blee/load_chart', :controller => 'blee', :action
> => 'load_chart'
>
> Running on Mac 10.6.2
> rails to 2.3.4
> Gem 1.3.5
> ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0]
> derailed-ziya-2.1.5
>
> Results
>
> pb$ ./script/server
> => Booting Mongrel
> => Rails 2.3.4 application starting onhttp://0.0.0.0:3000/Users/pb/Documents/source/rails_work/exchange/con...
Reply all
Reply to author
Forward
0 new messages