Ruby on Rails Saturday, December 6, 2014

What exactly are you trying to achieve???

On Monday, December 1, 2014 9:07:58 AM UTC-5, trekr67 wrote:
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/b18ffddf-4840-43b6-bec7-3f2ef7e51a5c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment