I am unable to load file based on the parameters passed to the rake rask
my code
task :update_s =>:environment do
puts 'enter file name for status'
file=STDIN.gets
file="config/status/#{file}"
license_status=YAML.load_file(file)
end
parameter passed is abc.yml but i get a error that
No such file or directory - config/status/abc.yml
but if i hardcode the file name (code given below ) it works
task :update_s =>:environment do
license_status=YAML.load_file("config/status/abc.yml")
end
I have tried few combination of it none of the worked. Is there a way to load a yml file based on parameters passed to the rake task.
This is because
getsreturns the newline character, sofileis actually"config/status/abc.yml\n"You can remove the newline character with
chomp: