Skip to content
This repository has been archived by the owner on Aug 10, 2020. It is now read-only.

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

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

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

redbar0n opened this issue Nov 14, 2011 · 6 comments

Comments

@redbar0n
Copy link

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.

@shiftb
Copy link
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
@indirect
Copy link
Contributor

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).

@indirect
Copy link
Contributor

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?

@redbar0n
Copy link
Author

@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.

@indirect
Copy link
Contributor

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)

@redbar0n
Copy link
Author

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 as completed in a7d830f Jul 31, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants