I have a running Rails app with the CarrierWave gem.
我有一个运行Rails应用程序与CarrierWave宝石。
I am able to see the CarrierWave class in the Rails console, and identify methods etc, but am not able to figure out how to print the configuration variables I set in my app. I looked over the docs and have set the config working correctly as per http://www.rubydoc.info/gems/carrierwave#Using_Amazon_S3 but was not able to figure out how to display config settings in the Rails console. It would allow on the fly changes and testing.
我能够在Rails控制台中看到CarrierWave类,并识别方法等,但我无法弄清楚如何打印我在应用程序中设置的配置变量。我查看了文档,并根据http://www.rubydoc.info/gems/carrierwave#Using_Amazon_S3设置了配置正常,但无法弄清楚如何在Rails控制台中显示配置设置。它将允许即时更改和测试。
This info would be useful for other gems too.
此信息对其他宝石也很有用。
1 个解决方案
#1
1
Let's say that your uploader class is PhotoUploader
假设您的上传器类是PhotoUploader
in the console
在控制台中
PhotoUploader.fog_credentials
PhotoUploader.fog_credentials
PhotoUploader.fog_directory
PhotoUploader.fog_directory
and so on
等等
Or as instantiated object
或者作为实例化对象
u = PhotoUploader.new
你= PhotoUploader.new
u.fog_credentials
u.fog_credentials
u.fog_directory
u.fog_directory
These will print out the initialized configuration.
这些将打印出初始化配置。
#1
1
Let's say that your uploader class is PhotoUploader
假设您的上传器类是PhotoUploader
in the console
在控制台中
PhotoUploader.fog_credentials
PhotoUploader.fog_credentials
PhotoUploader.fog_directory
PhotoUploader.fog_directory
and so on
等等
Or as instantiated object
或者作为实例化对象
u = PhotoUploader.new
你= PhotoUploader.new
u.fog_credentials
u.fog_credentials
u.fog_directory
u.fog_directory
These will print out the initialized configuration.
这些将打印出初始化配置。