F
Feng Luhan
I hava a yaml file as application config file. I use YAML::Store to
reset yaml key value, but it is not work. please help me!
y = YAML::Store.new( "#{RAILS_ROOT}/config_app/config.yml", :Indent => 2
)
y.transaction do
y['value'].key1 = 'aaa' # undefined method `[]' for
#<YAML:omainType>
y['value'].key2 = 'bbb'
end
File.open('config.yml','a+') do |file|
yy = YAML::load(file)
puts yy.value['key1'] # key1 = 111
yy.value['key1'] = 'aaa' # config.yml have not changed.
end
reset yaml key value, but it is not work. please help me!
y = YAML::Store.new( "#{RAILS_ROOT}/config_app/config.yml", :Indent => 2
)
y.transaction do
y['value'].key1 = 'aaa' # undefined method `[]' for
#<YAML:omainType>
y['value'].key2 = 'bbb'
end
File.open('config.yml','a+') do |file|
yy = YAML::load(file)
puts yy.value['key1'] # key1 = 111
yy.value['key1'] = 'aaa' # config.yml have not changed.
end