I've a file in the config
directory, let's say my_policy.txt.
I want to use the content of that file in my controller like a simple string.
@policy = #content of /config/my_policy.txt
How to achieve that goal, does Rails provide its own way to do that?
Thanks
Rails doesn't provide a way, but Ruby does:
@policy = IO.read("#{Rails.root}\config\my_policy.txt")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With