是的,只需使用AR::Base#becomes.
AR::Base#becomes
说你的基类是Account,子类是GuestAccount和LoginAccount.
Account
GuestAccount
LoginAccount
@account.is_a? LoginAccount? #=> true
然后你可以做一个
form_for [@account.becomes(Account), @comment] do |f| ...