BUG: unitialized constant Analytical::Modules::Production #30

Closed
redbar0n opened this Issue Nov 14, 2011 · 6 comments

Comments

Projects
None yet
4 participants

Hey,

I discovered a really annoying bug when you create the analytical.yml file exactly according to the readme, like this:

production:
google:
key: UA-5555555-5
clicky:
key: 55555

This will give the error:

uninitialized constant Analytical::Modules::Production

or

uninitialized constant Analytical::Modules::Kissmetrics

when calling the "analytical" helper from a controller or a view.

The error is resolved when removing the space before the API-keys, so the file looks like this:

production:
google:
key:UA-5555555-5
clicky:
key:55555

This is a very annoying bug, since it's almost impossible to detect.
I hope you're able to fix it soon.

PS: I would suggest to update the Readme in the meanwhile, so more people don't unnecessarily run into it by following the setup procedure there.

Cheers.

Contributor

shiftb commented Dec 8, 2011

The other way to fix is to add another environment setting (it can be empty):

development:
production:
{module}:
....

That seemed to fix it for me as well and actually handle environments correctly.

jkrall added a commit that referenced this issue Jan 22, 2012

Contributor

indirect commented Jan 27, 2012

The actual bug here is that the gem is trying to use a module named Kissmetrics, but the module is named KissMetrics (note the difference in capitalization).

Contributor

indirect commented Jan 27, 2012

Sorry, should have added the solution: The solution is to capitalize your YAML keys exactly the same way the ruby modules are capitalized. Here's an example analytical.yml file.

production:
  KissMetrics:
    js_url_key: "//blah.cloudfront.net/abc.js"
development:
test:

At that point, maybe you should catch the NameError, tell the users they tried to configure something that doesn't exist, and give them a list of valid module names?

@indirect
Are you sure? Try to remove these two lines from your analytical.yml file, and see if it still works:

development:
test:

I'm suspecting it might be @shiftbs quick fix that is actually at work here.

Contributor

indirect commented Jan 27, 2012

Yes, I'm completely positive, because I wrote a patch that fixes it and submitted it as a pull request. :)

On Jan 27, 2012, at 2:07 AM, redbar0nreply@reply.github.com wrote:

@indirect
Are you sure? Try to remove these two lines from your analytical.yml file, and see if it still works:

development:
test:

I'm suspecting it might be @shiftbs quick fix that is actually at work here.


Reply to this email directly or view it on GitHub:
#30 (comment)

Ah, sweet. :-) It's still mysterious to me though how it worked for me when I removed the whitespaces, while having the same capitalization..

@jkrall jkrall closed this in a7d830f Jul 31, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment