I have a Campaign model and a DeliverySchedule model. Campaign and
DeliverySchedule are related like thus: Campaign has one
So assuming I have Campaign @campaign, I can check it’s delivery
schedule like thus:
I create new campaigns from a form post like this (pretty standard):
@campaign = Campaign.new(params[:campaign])
My question is concerning how I can also create the delivery schedule
for the campaign in the same form post. All that’s required to make a
DeliverySchedule is a camapign_id:integer and a time:datetime. My
problem is that I can’t figure out how to name my HTML elements to
facilitate this, e.g.:
<input type=“hidden” name=campaign[delivery_schedule][time]"
value=“2007-09-20 12:34:34” />
However this causes a error:
ActiveRecord::AssociationTypeMismatch (DeliverySchedule expected, got
Any ideas how to do this?