0
我有config/application.rb
文件中的配置变量如下,如何追加字符串配置变量
config.user1= 'http://localhost:3001/user1'
config.user2= 'http://localhost:3002/user2'
config.user3= 'http://localhost:3003/user1'
config.user4= 'http://localhost:3004/user2'
我希望得到的配置变量动态如下,
a='.user1'
def config_d(a)
@b='Rails.configuration'[email protected]
puts @b #out put should be value of configuration variables 'http://localhost:3001/user1'
end
我必须通过a
动态地以config_d(user1)
为例
config(user1)
应该返回http://localhost:3001/user1
config(user2)
应该返回http://localhost:3002/user2
建议我任何技术来获得配置从字符串或哈希或任何其它数据结构的值。
在此先感谢, 苏雷什