Any example of using simple_form with polymorphic associations?

483 views
Skip to first unread message

Kedar Mhaswade

unread,
Jun 2, 2011, 8:42:02 AM6/2/11
to SimpleForm
Just wanted to know if f.association can be used when models have
polymorphic associations.
Any example would be appreciated.

e.g. how'd I render a form to choose a receiver (which could be either
an event or a member) with following models?

class Alert < ActiveRecord::Base
attr_accessible :type, :content
belongs_to :receiver, :polymorphic => true
end

class Event
has_many :alerts, :as => receiver
# ...
end

class Member
has_many :alerts, :as => receiver
end

# corresponding changes are available in migrations

Best Regards,
Kedar



Joe Ersinghaus

unread,
Aug 31, 2015, 9:18:42 PM8/31/15
to SimpleForm
Did you ever find an answer to this question? Or can anyone still post an example?
Reply all
Reply to author
Forward
0 new messages