Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Please help: uninitialized constant

Reply
Thread Tools

Please help: uninitialized constant

 
 
Andrew Dangerfield
Guest
Posts: n/a
 
      01-19-2011
Hello, I am new to ruby and trying to refactor some ruby code that just
consists of a few files containing a couple of small classes and am
running rspec on a specification file like "rspec collector_specs.rb"
and am getting the following error output and have been working on
fixing this for hours and am stumped, I am guessing I am making some
newbie mistake:

************************************************** ******************
C:/Ruby191/lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_view/helpers/tag_helper.rb:10:in
`<module:TagHelper>': u
ninitialized constant ActionView::Helpers::TagHelper::ERB (NameError)
from
C:/Ruby191/lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_view/helpers/tag_helper.rb:9:in
`<module:He
lpers>'
from
C:/Ruby191/lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_view/helpers/tag_helper.rb:6:in
`<module:Ac
tionView>'
from
C:/Ruby191/lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_view/helpers/tag_helper.rb:4:in
`<top (requ
ired)>'
from
C:/Ruby191/lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_view/helpers/javascript_helper.rb:1:in
`req
uire'
from
C:/Ruby191/lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_view/helpers/javascript_helper.rb:1:in
`<to
p (required)>'
from
C:/Ruby191/lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_view/helpers/url_helper.rb:1:in
`require'
from
C:/Ruby191/lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_view/helpers/url_helper.rb:1:in
`<top (requ
ired)>'
from
C:/Ruby191/lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_view/helpers/asset_tag_helper.rb:3:in
`requ
ire'
from
C:/Ruby191/lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_view/helpers/asset_tag_helper.rb:3:in
`<top
(required)>'
from C:/refactored/app/collector.rb:2:in `require'
from C:/refactored/app/collector.rb:2:in `<top (required)>'
from C:/refactored/app/collector_specs.rb:8:in `require'
from C:/refactored/app/collector_specs.rb:8:in `<top
(required)>'
from
C:/Ruby191/lib/ruby/gems/1.9.1/gems/rspec-core-2.4.0/lib/rspec/core/configuration.rb:387:in
`load'
from
C:/Ruby191/lib/ruby/gems/1.9.1/gems/rspec-core-2.4.0/lib/rspec/core/configuration.rb:387:in
`block in load_
spec_files'
from
C:/Ruby191/lib/ruby/gems/1.9.1/gems/rspec-core-2.4.0/lib/rspec/core/configuration.rb:387:in
`map'
from
C:/Ruby191/lib/ruby/gems/1.9.1/gems/rspec-core-2.4.0/lib/rspec/core/configuration.rb:387:in
`load_spec_file
s'
from
C:/Ruby191/lib/ruby/gems/1.9.1/gems/rspec-core-2.4.0/lib/rspec/core/command_line.rb:18:in
`run'
from
C:/Ruby191/lib/ruby/gems/1.9.1/gems/rspec-core-2.4.0/lib/rspec/core/runner.rb:55:in
`run_in_process'
from
C:/Ruby191/lib/ruby/gems/1.9.1/gems/rspec-core-2.4.0/lib/rspec/core/runner.rb:46:in
`run'
from
C:/Ruby191/lib/ruby/gems/1.9.1/gems/rspec-core-2.4.0/lib/rspec/core/runner.rb:10:in
`block in autorun'
************************************************** ******************


Does anyone know what is causing this error and how I can eliminate it?
The code referencing actionview modules is:

************************************************** ******************
require 'rubygems'
require 'action_view/helpers/asset_tag_helper'
require 'action_view/helpers/tag_helper'
require 'erb'

class Collector

include ActionView::Helpers::TagHelper
include ActionView::Helpers::AssetTagHelper

def self.foo
"foo"
end

def display(profile, size, html = {}, options = {}, link = true)

... unrelated code here ...

return image_tag("default.png")
end

end
************************************************** ******************

I am just starting out with ruby programming and have a lot to learn, so
any and all help and input is most appreciated.

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Andrew Dangerfield
Guest
Posts: n/a
 
      01-20-2011
I am still stuck on this error, any help for a newbie?

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Marc-andré Lafortune
Guest
Posts: n/a
 
      02-19-2011
There's apparently a circular loading issue in Rails 3 (any helper loads
ActionView::Helpers with loads all helpers).

In this case, you probably don't need the two helper requires; just
remove them:

- require 'action_view/helpers/asset_tag_helper'
- require 'action_view/helpers/tag_helper'

Alternatively (e.g. if you run into problems and actually need to
include them), you replace them with a single require:

+ require 'action_view/helpers'

Note that this require will fail in Rails 2.x though.

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
uninitialized constant ApplicationController (NameError) Daniel Ruby 2 06-22-2006 08:39 AM
ruby - rexml/streamlistner - error: uninitialized constant jsp408@comcast.net Ruby 2 06-15-2006 11:30 AM
ruby-ldap: uninitialized constant LDAP::LDAP_CONTROL_PAGEDRESULTS James Hughes Ruby 4 12-13-2005 11:46 PM
Uninitialized constant objects =?ISO-8859-1?Q?Ney_Andr=E9_de_Mello_Zunino?= C++ 5 06-01-2005 11:31 AM
uninitialized constant Magick in RMagick Todd Gardner Ruby 3 06-17-2004 09:55 AM



Advertisments