0
我在Raisl 4/ActiveAdmin應用程序中有兩個模型/資源。主動管理員嵌套表單編輯用戶信息
class AdminUser < ActiveRecord::Base
devise :database_authenticatable, :recoverable, :rememberable, :trackable, :validatable
has_one :photographer
end
class Photographer < ActiveRecord::Base
belongs_to :admin_user, dependent: :destroy
accepts_nested_attributes_for :admin_user
end
ActiveAdmin.register Photographer do
permit_params :code, :nickname, :profile, :facebook_url, :twitter_url, :instagram_url, :address, :complement, :zip_code, :city, :state, :country,
:phone, :cellphone, :commission, :withhold_tax, :bank_number, :bank_branch_number, :bank_account_number, :identity_document_number,
:rfb_document_number, admin_user_attributes: [:email, :password, :password_confirmation]
form do |f|
f.inputs for: [:admin_user, (f.object.admin_user || f.object.build_admin_user)] do |auf|
auf.input :email
auf.input :password
auf.input :password_confirmation
end
f.inputs do
f.input :code
f.input :nickname
f.input :profile
f.input :facebook_url
f.input :twitter_url
f.input :instagram_url
f.input :address
f.input :complement
f.input :zip_code
f.input :city
f.input :state
f.input :country, as: :string
f.input :phone
f.input :cellphone
f.input :commission
f.input :withhold_tax
f.input :bank_number
f.input :bank_branch_number
f.input :bank_account_number
f.input :identity_document_number
f.input :rfb_document_number
end
f.actions
end
end
創造的過程/驗證但是可以正常使用,而無需更改電子郵件編輯攝影師,當我得到的錯誤「電子郵件已經採取」按實際關聯ADMINUSER紀錄被創造,而不是編輯。