Skip to content
This repository has been archived by the owner on May 4, 2019. It is now read-only.

UrlGenerator#user_id throws an error when :dropbox_credentials is set via yaml file #54

Closed
SleepyDeveloper opened this issue Jan 24, 2015 · 1 comment

Comments

@SleepyDeveloper
Copy link

I just installed this gem and followed the readme me to configure paperclip for dropbox. I used a yaml file to set my credentials.

I was able to upload to dropbox just fine, but when I tried to display my image with .url, I got the following exception:

undefined method `[]' for #Pathname:0x007fce810b02a0

After reconfirming that I had set everything up correctly, I traced the code and discovered that error was occurring in UrlGenerator#user_id.

def user_id
    @attachment_options[:dropbox_credentials][:user_id]
end

For some reason @attachment_options[:dropbox_credentials] is not a hash, but a Pathname. Since it's a Pathname [:user_id] causes an exception. If i change :dropbox_credentials to a hash in my model, @attachment_options[:dropbox_credentials] is a hash and everything works as expected.

My system configuration is:

ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-darwin14.0]
Rails 4.1.1
paperclip (4.2.1)
paperclip-dropbox (1.3.0)

@SleepyDeveloper
Copy link
Author

After downgrading to version 1.2.2 the error went away. Looks like it might be a side effect of merging
pull request #52

@janko janko closed this as completed in 1d3b451 Jan 29, 2015
janko added a commit that referenced this issue Jan 29, 2015
Concerns #54
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

1 participant