-
Notifications
You must be signed in to change notification settings - Fork 157
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
Globalize3 compatibility #41
Comments
That sounds best to me if it's straightforward to do. |
@zdennis Hi, I just got a problem when using SeedFu with Globalize. The problem is that SeedFu's constraints does only recognize column names, while Globalize requires developers to remove duplicated columns from model's table. And unfortunately the gem you mentioned is not accessible anymore, so I can't confirm if the problem I got is the same as you had. So how did you solve this problem? Or did you submitted another patch to SeedFu? Or you just don't use SeedFu anymore? Thanks! |
FWIW, I replicated the behaivour by using only ActiveRecord. I would prefer using seed-fu as before, but for one model I use the following work-around: seed_fu_attr_array.each do |attrs|
obj = App::ModelName.find_or_initialize_by(
unique_attr: attrs.delete(:unique_attr)
)
obj.attributes = attrs
obj.save!
end Replace HTH |
seed-fu doesn't currently work with globalize3 (if you try to seed models with translated attributes). I made a seed-fu-globalize3 gem which adds this functionality.
https://github.com/mhs/seed-fu-globalize3
I'm not in love with overriding a couple private methods of SeedFu::Seeder, but it got the job done. Any interest if I submit a patch to add this to seed-fu itself or would you like to leave this sort of thing as a separate gem?
If separate, what do you think about genericizing some of seeder functionality so other libraries could hook into it? (such as identifier valid column names and finding existing models).
WDYT?
The text was updated successfully, but these errors were encountered: