app/controllers/neofiles/admin_controller.rb in neofiles-1.1.1 vs app/controllers/neofiles/admin_controller.rb in neofiles-1.1.2
- old
+ new
@@ -87,11 +87,11 @@
errors.push("#{I18n.t('neofiles.file_not_passed')} (#{i + 1})") and next unless uploaded_file.respond_to? :read
file_class = Neofiles::File.class_by_file_object(uploaded_file)
file = file_class.new do |f|
f.description = data[:description].presence || old_file.try(:description)
- f.no_wm = data[:no_wm].present? && data[:no_wm] != '0'
+ f.no_wm = data[:no_wm].present? && data[:no_wm] != '0' if f.respond_to? :no_wm
f.file = uploaded_file
end
begin
Rails.application.config.neofiles.before_save.try!(:call, file)
@@ -159,10 +159,10 @@
file = file_class.new do |f|
f.owner_type = owner_type
f.owner_id = owner_id
f.description = request[:description].presence
- f.no_wm = true if f.respond_to?(:no_wm)
+ f.no_wm = true if f.respond_to? :no_wm
f.file = file
end
Rails.application.config.neofiles.before_save.try!(:call, file)
file.save!
\ No newline at end of file