red-rocks / rails_admin_multiple_file_upload

MIT License
2 stars 0 forks source link

Are you sure your gem would work correctly? #1

Open pegasus430 opened 8 years ago

pegasus430 commented 8 years ago

Now I am on facing to use your gem, but that doesn't works for some reasons. Can you tell me why? I did bundle install after checking in my gemfile, and add the following in rails_admin.rb

RailsAdmin.config do |config| config.actions do ...... multiple_file_upload do visible do %w(Page).include? bindings[:Image].model_name end end end end

and I customized my code for image model.

has_mongoid_attached_file :imagen, styles: {main: "1000x1000>"}

But that doesn't works as I exptected. If you have any positive idea, I'd appreciate very much.

ack43 commented 8 years ago
  1. Your config for rails_admin is wrong. Use %w(Page).include? bindings[:abstract_model].model_name instead of %w(Page).include? bindings[:Image].model_name bindings[:abstract_model] explanation
  2. Also you need 2 models: Page and PageImage(for example). And PageImage has to be embedded in Page.

Correct code: Parent model Embedded model has_mongoid_file_upload .... for embedded model is inherited from this rails_admin config for parent model

Unfortunately documentation is not written completely. I will correct it soon.