Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

identifier method returns nil #822

Closed
HuckyDucky opened this Issue · 7 comments

6 participants

HuckyDucky Hans Alexander Bierbrauer Benjamin Knofe Philip Ingram James Miller
HuckyDucky

I'm using v0.6.2 to persist uploaded files to S3. The files are getting up there fine. My object is Catalog, and the uploader is for a string field called "asset".

I can call:

c = Catalog.first
c.asset.url
c.asset.current_path

yet the following call returns nil:

c.asset.identifier

The only way I can get the identifier is if I call:

c[:asset]

The file is definitely there in S3, and I can view it.

Hans

Have the same problem using last version and using file storage. My auploader is named file_uploader and I have also redefined the store dir as

def store_dir
if !model.forum.nil? then forum="Forum_#{model.forum.id.to_s}" else forum='Forum_???' end
if model.kind.include?('user') then kind='user_files' else kind='forum_files' end
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{forum}/#{kind}/#{model.id}"
end

Alexander Bierbrauer

I have the same issue with file storage. The db column is named "file" but I have also other models with different column names with the same issue.

Hans

I think it is a namespace problem. I think the name identifier also is used in another context i carrierwave. I solved the problem by adding the following method to my uploader FileUploader,
The attribute file seems to work in any uploader so that attribute must be an attribute that carrier adds. I was just lucky to use the same name in my carrier column

def identifier!
self.file.identifier
end

Hope this solve the problem for you too

Benjamin Knofe

I can confirm this error in carrierwave (0.6.2). Would love to see this fixed! Thanks! :heart: :heart: :heart:

Philip Ingram

Same here. Thought it was me... for the nine millionth time. good to see a weird error has friends at least, this time.

== EDIT ===
I think i have something. going to do a pull request. It fixes the problem at least.

Philip Ingram

Ok have a pull request. Maybe one or two of you guys in this issue thread could try it out to see if it fixes your situation too? Works in mine and all tests pass in the rubies.

James Miller
Owner

Closing in favor of #900. Please try out that fix and report back. Thanks!

James Miller bensie closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.