У меня возникла странная проблема после активации активации. Модель с скрепкой атрибута has_mongoid_attached_file исключения возврата:рельсы 4 изобретать с помощью скрепки, неопределенный метод after_commit
undefined method `after_commit' for Item:Class
/home/student/.rvm/gems/ruby-2.1.0/bundler/gems/paperclip-c9c5227cb7f8/lib/paperclip/has_attached_file.rb:89:in `add_active_record_callbacks'
/home/student/.rvm/gems/ruby-2.1.0/bundler/gems/paperclip-c9c5227cb7f8/lib/paperclip/has_attached_file.rb:19:in `define'
/home/student/.rvm/gems/ruby-2.1.0/bundler/gems/paperclip-c9c5227cb7f8/lib/paperclip/has_attached_file.rb:4:in `define_on'
/home/student/.rvm/gems/ruby-2.1.0/bundler/gems/paperclip-c9c5227cb7f8/lib/paperclip.rb:179:in `has_attached_file'
mongoid-paperclip (0.0.8) lib/mongoid_paperclip.rb:70:in `has_mongoid_attached_file'
, как я понимаю, вопрос в видимости after_commit в самоцветах/скрепка-3.5.3/Библиотека/скрепка/has_attached_file.rb
def add_active_record_callbacks
name = @name
@klass.send(:after_save) { send(name).send(:save) }
@klass.send(:before_destroy) { send(name).send(:queue_all_for_delete) }
@klass.send(:after_commit, :on => :destroy) { send(name).send(:flush_deletes) }
end
В Gemfile Я играл с различными драгоценными камнями, включая сильные_параметры и protected_attributes, но не добился прогресса.
EDIT: я строка комментария @ klass.send (: after_commit,: на =>: уничтожить) {отправить (имя) .send (: flush_deletes)} и вопрос сейчас в правильной реализации скрепку с Mongoid
EDIT: нашел лучшее решение в https://github.com/thoughtbot/paperclip/pull/1425/files