Ruby on Rails Monday, December 1, 2014

Hi,

New to ruby development so wondering if someone could help...

I have this code in a file1.rb

#file1.rb

module GG
class GG

::NAME = 'gginfrausermanager'

    end
end

and want to call this variable in another file2.rb with the following code:

#file2.rb

require './file1.rb'
include GG

p "#{GG::NAME} is called from file1.rb"

However when I do a ruby file2.rb I get uninitialized constant GG::NAME.

Can you tell me what I'm doing wrong?

Thanks!

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b4102b36-827e-435a-9172-dde275a8cbc9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment