Hi Zovar
You can do it different ways.one method is create a file say
global_data.rb in the folder config/initializers Then define these
array there.You can also define also a module there like
in global_data.rb
module GlobalData
my_array = ['ICQ','AIM', 'GTALK']
end
Now you can access this from anywhere in your application like
GlobalData::my_array
If you want you can freeze this also like
module GlobalData
my_array = ['ICQ','AIM', 'GTALK']
end
GlobalData.freeze
Or if you want global variables(Please avoid its use as far as possible)
you can do like inside this same file global_data.rb
$my_array = ['ICQ','AIM', 'GTALK']
So from anywhere you can access it like $my_array
You can also think of defining my_array above as constant if
needed
Sijo
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---