Hi,
I''ve put code very similar to the following code in the lib directory.
module Common
A_CONSTANT = [ ''one'', ''two'',
''three'', ''four'' ]
def a_method(session)
if !session[:d] then
session[:d] = ''a string constant''
end
... more of the same ...
end
end
The file containing this code is named ''common.rb''. The
constant and
method are then referenced in a number of my controllers similar to
the following:
class MyController ...
def index
...
some_variable = Common::A_CONSTANT
...
Common.a_method(session)
...
end
When the app is run, ruby/rails is able to resolve the A_CONSTANT
reference, but I can''t seem to get the method to resolve.
I''ve tried
using require in the controller files, I''ve tried delimiting the
method with double colons and I''ve tried different names for the
module while making sure the file and module names in sync. What am I
doing wrong?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---