Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Carrierwave with amazon s3 not work with counter_culture gem #18

Closed
shir opened this issue Jun 25, 2013 · 3 comments
Closed

Carrierwave with amazon s3 not work with counter_culture gem #18

shir opened this issue Jun 25, 2013 · 3 comments

Comments

@shir
Copy link

shir commented Jun 25, 2013

If you create model like this

class UploadTest < ActiveRecord::Base

  belongs_to :category

  attr_accessible :category_id, :something

  mount_uploader :something, PhotoUploader

  counter_culture :category
end

with uploader connected to s3 (fog and carrierwave-aws backends have same behavior) after updating file only file name in database is updated, but new file on s3 is not uploaded (old file stays on s3). This issue only on updating file, creating new object works ok.

I've created same issue in carrierwave project.

@magnusvk
Copy link
Owner

Have you isolated this problem and made sure this is really caused by counter_culture? I.e., if you leave everything else the same, and only remove counter_culture, then it works?

I just took a look at the code to see how counter_culture could be causing this and I honestly don't see how. counter_culture adds a after_create, after_destroy and after_update callback -- but those all have unusual names and shouldn't interfere with any other hooks.

I'm going to close this for now as I don't think this is related to counter_culture. Feel free to reopen if you have some more information tying this directly to counter_culture.

@danielevans
Copy link

@magnusvk I have. I have uploads which fail to save the file (both s3 and file stores) and commenting out the model's counter_culture line fixes it. Also overriding _update_counts_after_update to a no-op eliminates the error but overriding after_commit_action's _after_commit_hook does not eliminate the problem. I'm still investigating and hope to find the problem.

@danielevans
Copy link

I've found the problem, and it is not a bug in counter_culture. The problem is that carrierwave is not properly handling the dup and there is already a PR to fix it: carrierwaveuploader/carrierwave#1544

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants