I have Rails 5 API app with active admin that's working fine. I created a class in lib which calls app_languages.rb and contains array of hashes for language properties. I want to share the data in my active admin resources and use it, but It's not working. I tried writing require '/lib/app_languages.rb' but it's not working and I get this error: cannot load such file -- /lib/app_languages.rb
this is app_languages.rb:
class AppLanguages
keys = [:language, :flag]
values = ["English", "EN", "French", "FR", "Spanish", "SP", "Japanese", "JPN", "Hebrew", "HEB"]
LANG = values.each_slice(2).map { |value| Hash[keys.zip(value)] }
end
How can I gain access to app_languages.rb's variables from a resource in active admin?
EDIT: I read that in rails 5 there's a problem with autoload so I already configured this in application.rb: config.autoload_paths << "#{Rails.root}/lib"
and configured in every enviroment: config.eager_load = true