RubyNoob
RubyNoob

Reputation: 243

undefined method 'path' for nil:NilClass using chargify_api_ares gem

I feel like this should be a simple problem, but I'm pulling my hair out trying to track it down. I'm installed the chargify_api_ares gem, but can't do even basic things such as

Chargify::Subscription.create

As I get this path error. I feel like this must be a gem issue somehow but don't know where to go from here.

UPDATE: bundle show chargify_api_ares shows the correct path, I just somehow can't access it. Still trying random environment related things.

Looks like this is the source of the problem, in active_resource\base.rb:

# Gets the \prefix for a resource's nested URL (e.g., <tt>prefix/collectionname/1.json</tt>)
      # This method is regenerated at runtime based on what the \prefix is set to.
      def prefix(options={})
        default = site.path
        default << '/' unless default[-1..-1] == '/'
        # generate the actual method based on the current site path
        self.prefix = default
        prefix(options)
      end

As I understand it, Chargify.subdomain should be setting the site.path, but I don't understand activeresource well enough yet to know what's happening and will continue to dig.

Upvotes: 5

Views: 1384

Answers (1)

commander_nemesis
commander_nemesis

Reputation: 23

I too had the same issue. I executed the following on the console

Chargify.configure do |c|
  c.api_key   = "<<api_key>>"
  c.subdomain = "<<subdomain>>"
end

After that performing any Chargify console commands went through fine.

Upvotes: 0

Related Questions