app/controllers/cas/sites/sections/contents_controller.rb in cas-cms-1.0.0.alpha1 vs app/controllers/cas/sites/sections/contents_controller.rb in cas-cms-1.0.0.alpha2

- old
+ new

@@ -23,10 +23,11 @@ ActiveRecord::Base.transaction do @content.author_id = current_user.id @content.section_id = @section.id @content.tag_list = content_params[:tag_list] if content_params[:tag_list] success = @content.save! + ::Cas::Activity.create!(user: current_user, site: @site, subject: @content, event_name: 'create') associate_files(@content, :images) associate_files(@content, :attachments) end rescue ActiveRecord::RecordInvalid @@ -94,10 +95,12 @@ def content_params @content_params ||= begin # When no file is uploaded, when the content form is submitted the # `file` input ends up being sent empty (e.g file: [""]). This confuses # Rails. - params[:content].delete(:file) if params[:content][:file].map(&:presence).compact.blank? + if params[:content][:file].present? + params[:content].delete(:file) if params[:content][:file].map(&:presence)&.compact.blank? + end result = params.require(:content).permit( :category_id, :title, :location,