-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 is not compatible with Globalize3 #418
Comments
Can you provide a small sample app or something? Is this an old Rails version? Maybe it doesn't support the "dirty tracking" features we assume to be present? CarrierWave is now Rails 3 only. |
I am using rails 3.0.9. All you really need to do to reproduce the problem is install Globalize3 and Carrierwave then call "translate" on one of your columns in your model and run the Globalize migration (This basically create a new table called model_name_translations with the column you specified and a row for each locale) If you use one of those text columns with Carrierwave you get "undefined method `attribute_will_change!" error Globalize3 hides the fact that your column is in a different table by allowing you to access it using model_name.col while Globalize3 fetch the current value for your current locale and I guess this is where CarrierWave doesn't get along with Globalize3. |
Thanks for the info. I'm sorry to say, but I haven't heard of this issue before, so you may be the only person experiencing it. That means you may have to take it upon yourself to try and fix it, if you have the time and ability. I'll leave this issue open for now, but if you (or someone else) doesn't find a resolution, we'll document the problem in the "known issues" wiki page and leave it at that. I'm sorry for the problem. Good luck! |
I'm going to close this for now. Feel free to add an entry to the "known issues" wiki page and/or call for help on the Google Group. |
Here is an example how to make translated attachments (If you have different images in different languages): class Page < ActiveRecord::Base
translates :title, :banner
accepts_nested_attributes_for :translations
Translation.mount_uploader :banner, BannerUploader
end work fine for me |
Thanks osegrums for you snippet, but it still does not work for me. Is there any other workaround? |
@osegrums calling |
@effkay, @jenzer this might not be relevant to you now after a year but for those that stumble upon this page while researching what translations method would work with carrierware I'll elaborate what you need to do in order to get pass the |
@hugobast, @osegrums - thanks a lot for the suggestions on solving this kind of issue - unfortunately it seems like this is not enough in my code. I have 'Posts', that have many 'Attachments' (1 to n), and these have several localizations as attachment 'files'. It seems to make no difference whether I try to save the attachments putting The params['file'] contains the full ActionDispatch Object, so I'm assuming that it's not being recognized that I'm trying to upload a file. |
I was having the exact same problem that @effkay was; fixed it by making sure that "translates :banner" was before mount_uploader. |
Have the same issue.
Went saving, everything looks ok: If I try to the command |
When trying to use CarrierWave on a Globalize3 Column (ActiveRecords) the app crashes with an error:
undefined method `attribute_will_change!
The combination of Carrierwave and Globalize3 can be very useful if the admin wants to upload different images for different locales.
The text was updated successfully, but these errors were encountered: