Sean Schofield
unread,Jun 17, 2008, 9:48:43 AM6/17/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to attribute_fu
I'm probably missing something obvious here. I have two models:
Option
has_many :costs, :as => :costable, :attributes => true
Cost
belongs_to :costable, :polymorphic => true
validates_presence_of :costable
When I am creating a new form, I am not able to create costs at the
same time. The validation keeps complaining that the cost is
invalid. I quickly figured out the problem was that costable had not
been set yet. Everything works fine if I add the cost after saving
the new option first.
Any suggestions for how to address this elegantly with a_f?
TIA,
Sean