Rails Adwords API - cannot load such file -- adwords_api

401 views
Skip to first unread message

Richard Henry

unread,
Jul 8, 2015, 3:20:14 PM7/8/15
to adwor...@googlegroups.com
Hi,

I am new to the AdWords API and I am using rails and will use the Client Library provided. I am trying to integrate it with the Rails framework and I've setup my adwords_api.yml in the config file and tried to require this in my controller but I keep getting:

cannot load such file -- /Users/Richard/Desktop/wdi_13/projects/final_project/clean_project/adwords_app/config/adwords_api


my controller code is:

require "#{Rails.root}/config/adwords_api"

class ReportsController < ApplicationController
  
  def index
    adwords = AdwordsApi::Api.new
    token = adwords.authorize()
  end


end

I've looked into it and i thought it may be something to do with the path, which is why I have the Rails.root there but the path with this is definitely correct.

Any help would be greatly appreciated!

Thanks,
Rick
 

Michael Cloonan (AdWords API Team)

unread,
Jul 9, 2015, 9:30:32 AM7/9/15
to adwor...@googlegroups.com, r.hen...@gmail.com
Hello Rick,


As for your specific error, if you don't specify a location for the config file, the client library will look in ENV['HOME'], not in your rails root directory. Take a look in the example's ApplicationController, in the create_adwords_api method. Here, when instantiating the API, it passes the full file path so that it looks in the correct directory.

Regards,
Mike, AdWords API Team

Arjun Rajkumar

unread,
Mar 28, 2017, 1:32:31 AM3/28/17
to AdWords API Forum, r.hen...@gmail.com
Hi Richard, 

Were you able to get this fixed? Running into the same issue using Rails. 

Getting a load error - 'cannot load such file -- adwords_api'

I am requiring the 'adwords_api' file in the controller when getting this error. 

Would be great to know how you fixed this issue. 

Thanks

Arjun

Michael Cloonan (AdWords API Team)

unread,
Mar 28, 2017, 8:38:17 AM3/28/17
to AdWords API Forum, r.hen...@gmail.com
Hello,

Can you provide more details about exactly what you're trying to include? Once the adwords_api gem is installed, you should simply have to have a line:

require 'adwords_api'

If that's not working, please double-check that the google-adwords-api gem is correctly installed.

Regards,
Mike, AdWords API Team

Reply all
Reply to author
Forward
0 new messages