Skip to content
This repository has been archived by the owner on Feb 11, 2023. It is now read-only.

carrierwave-datamapper confuses the Uploader property with the underlying identifier property #11

Open
postmodern opened this issue Feb 9, 2012 · 2 comments

Comments

@postmodern
Copy link
Contributor

resource.attachment.filename always returns nil due to CarrierWave not being able to access the underlying identifier column. This occurs when the identifier column has the same name as the Uploader property (which currently is the only way to use carrierwave-datamapper due to issue #9).

However, I can directly access the identifier column using instance_variable_get("@attachment"). Also, resource.attachment.path behaves as expected.

carrierwaveuploader/carrierwave#249

Environment details:

  • Ruby: 1.8.7-p357
  • Rails: 3.0.11
  • DataMapper: 1.1.0
  • carrierwave: 0.5.8
  • carrierwave-datamapper: 0.2.0
@postmodern
Copy link
Contributor Author

resource.attachment.filename does appear to work when the resource is new and unsaved.

@phrozen
Copy link

phrozen commented Oct 3, 2012

Is there any workaround this issue?? It is pretty neat not having to define a property for the storage as carrierwave does this automatically now, but I want to read just the filename stored in the database and as I'm using config.storage = :fog and config.fog_public = false I'm always getting and authenticated link to the filename in AWS. How do I read just the filename stored on the DB?

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

2 participants