I'm trying to use the evernote gem to access the Evernote API. In those instructions, it says to create a config file containing the API account details, and then load the config file as follows:
config = File.dirname(__FILE__) + "/config.yml"
user_store = Evernote::UserStore.new(user_store_url, config, "sandbox")
I created a file evernote.yml
in the config folder, and put the following code in the home
action in pages_controller.rb
config = File.dirname(__FILE__) + "/evernote.yml"
user_store = Evernote::UserStore.new(user_store_url, config, "sandbox")
When the code is run, I get this error on the 2nd line
Errno::ENOENT in PagesController#home
No such file or directory - /Users/ben/rails_projects/evernote_app/app/controllers/evernote.yml
How do I load the config file without getting this error?
To load Configs, select the configurations you want to load and click Load. To load multiple instances of one Config, select the config you want to load and click Load As.... The Custom Load window opens, allowing you to specify Config File, Config Run name, Config Password, and Property Store Value.
In computing, configuration files (commonly known simply as config files) are files used to configure the parameters and initial settings for some computer programs. They are used for user applications, server processes and operating system settings.
There are thousands of configuration files on your computer. You may never directly interact with the bulk of them, but they're scattered throughout your /etc folder and in ~/. config and ~/. local and /usr .
Windows Config Files Windows users will find the hosts file in c:\windows\system32\drivers\etc\. You can open it by double-clicking the mouse and selecting Notepad from the list of suggested apps. This is all you need to view and edit config files like hosts.
If you are using Rails, since 4.2 there's a builtin way to do that:
config = Rails.application.config_for(:evernote)
Source: https://www.justinweiss.com/articles/the-lesser-known-features-in-rails-4-dot-2
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