# Html element map to AR model naming scheme help

**URL:** <https://www.ruby-forum.com/t/html-element-map-to-ar-model-naming-scheme-help/120545>\
**Category:** Rails\
**Created:** [November 18, 2007, 9:29am UTC](https://www.ruby-forum.com/t/html-element-map-to-ar-model-naming-scheme-help/120545 "2007-11-18T09:29:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![eggie5](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7c8e57/32.png) [@eggie5](https://www.ruby-forum.com/u/eggie5)\
**Post date:** [November 18, 2007, 9:29am UTC](https://www.ruby-forum.com/t/html-element-map-to-ar-model-naming-scheme-help/120545/1 "2007-11-18T09:29:41Z")

</div>

I have a Campaign model and a DeliverySchedule model. Campaign and  
DeliverySchedule are related like thus: Campaign has one  
DeliverySchedule.

So assuming I have Campaign @campaign, I can check it’s delivery  
schedule like thus:

@campaign.delivery\_schedule

* * *

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  
HashWithIndifferentAccess):

Any ideas how to do this?
