[Nitro] devlab sources and cattr_accessor

rjspotter webmaster at rjspotter.com
Fri Jun 2 04:28:11 EDT 2006


So I dl'ed the development sources from the darcs repository at 
http://devlab.oree.ch/darcs/nitrohq/ to fix the trailing 404 bug using 
nitro under mongrel.

Immediately had this error:

irb(main):001:0> require 'nitro_and_og'
/usr/local/lib/ruby/gems/1.8/gems/facets-1.3.3/lib/facets/core/class/cattr.rb:39: 
warning: parenthesize argument(s) for future version
SyntaxError: compile error
/usr/local/lib/ruby/gems/1.8/gems/facets-1.3.3/lib/facets/core/class/cattr.rb:39: 
parse error, unexpected tIDENTIFIER, expecting '\n' or ';'
         def self.The value is already used
                              ^
/usr/local/lib/ruby/gems/1.8/gems/facets-1.3.3/lib/facets/core/class/cattr.rb:40: 
parse error, unexpected tIDENTIFIER, expecting $
           @@The value is already used
                      ^
         from 
/usr/local/lib/ruby/gems/1.8/gems/facets-1.3.3/lib/facets/core/class/cattr.rb:40:in 
`cattr_reader'
         from 
/usr/local/lib/ruby/gems/1.8/gems/facets-1.3.3/lib/facets/core/class/cattr.rb:38:in 
`cattr_reader'
         from 
/usr/local/lib/ruby/gems/1.8/gems/facets-1.3.3/lib/facets/core/class/cattr.rb:96:in 
`cattr_accessor'
         from 
/usr/local/lib/ruby/gems/1.8/gems/og-0.30.0/lib/og/validation.rb:13
         from 
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'
         from /usr/local/lib/ruby/gems/1.8/gems/og-0.30.0/lib/og.rb:194
         from 
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'
         from 
/usr/local/lib/ruby/gems/1.8/gems/nitro-0.30.1/lib/nitro_and_og.rb:2
         from 
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
         from (irb):1

So, after a little poking around I found the docs for cattr_accessor.  I 
changed the code in og/validation from:

   class Errors
     cattr_accessor :not_unique, 'The value is already used'
     cattr_accessor :invalid_relation, 'Invalid relations'
   end

to

   class Errors
     cattr_accessor :not_unique
     self.not_unique = "The value is already used"
     cattr_accessor :invalid_relation
     self.invalid_relation = "Invalid relations"
   end

based on my understanding of the docs.  Everything works... now, someone 
tell my why I'm wrong.

rjspotter
-- 
"If people keep creating new Java applications, the world is going to 
come to an end"
--David Heinemeier Hansson



More information about the Nitro-general mailing list