user3675188
user3675188

Reputation: 7419

activeadmin can not upload images under nested model Unpermitted parameters

I can not upload images in activeadmin

enter image description hereRemoteFocu has many RemoteFocuLog

class Tool::Cvt::RemoteFocu < ActiveRecord::Base
  belongs_to :user
  has_many :remote_focu_logs, :dependent => :destroy#, :autosave => true
  accepts_nested_attributes_for :remote_focu_logs, allow_destroy: true

admin/remotefocu

  # New/Edit forms
  form :html => { :multipart => true } do |f|
     f.has_many :remote_focu_logs do |p|
       p.input :snapshot, :as => :file
     end
    f.actions
  end
    permit_params :user_id, :ip, :model, :version, :setting, :comment, :result_path, :status,:remote_focu_logs_attributes, :utf8, :_method, :authenticity_token, :commit, :locale, :id

Error log

Unpermitted parameters: remote_focu_logs_attributes
Unpermitted parameters: utf8, _method, authenticity_token, commit, locale, id
   (0.1ms)  BEGIN
   (0.1ms)  ROLLBACK

Upvotes: 0

Views: 604

Answers (1)

nistvan
nistvan

Reputation: 2970

Try to permit remote_focu_logs_attributes: [:id, :snapshot, :_destroy] instead of :remote_focu_logs_attributes

Upvotes: 3

Related Questions