# Date\_select intercept in model

**URL:** <https://www.ruby-forum.com/t/date-select-intercept-in-model/83926>\
**Category:** Rails\
**Created:** [January 30, 2007, 8:56pm UTC](https://www.ruby-forum.com/t/date-select-intercept-in-model/83926 "2007-01-30T20:56:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![simon1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@simon1](https://www.ruby-forum.com/u/simon1)\
**Post date:** [January 30, 2007, 8:56pm UTC](https://www.ruby-forum.com/t/date-select-intercept-in-model/83926/1 "2007-01-30T20:56:50Z")

</div>

Hi there!

Currently im using date\_select to select a day and month of the year.  
But i’m hiding the year since it is not important. But when i try to  
save to the database the controller complains that the year is  
missing. Can i set the year to for example Time.now.year in the model?

date\_select(“timesheet”, “date”, :discard\_year =\>  
true, :use\_short\_month =\> true)

Best regards,  
Simon

---

<div class="post-metadata">

**Author:** ![simon1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@simon1](https://www.ruby-forum.com/u/simon1)\
**Post date:** [January 30, 2007, 9:20pm UTC](https://www.ruby-forum.com/t/date-select-intercept-in-model/83926/2 "2007-01-30T21:20:52Z")

</div>

Can you post the error message that you’re receiving?

Steve

---

<div class="post-metadata">

**Author:** ![simon1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@simon1](https://www.ruby-forum.com/u/simon1)\
**Post date:** [January 31, 2007, 10:31am UTC](https://www.ruby-forum.com/t/date-select-intercept-in-model/83926/3 "2007-01-31T10:31:47Z")

</div>

Hi, it seems that date(1i) is missing and that is why i get the error.  
But i would like to set the year in the model and use create in the  
controller instead of new where i can manually set the year.

ActiveRecord::MultiparameterAssignmentErrors in  
TimetrackController#create  
1 error(s) on assignment of multiparameter attributes

Request  
Parameters: {“commit”=\>“Spara”, “timesheet”=\>{“time”=\>“44”,  
“bc\_project\_id”=\>“855290”, “date(2i)”=\>“1”, “date(3i)”=\>“31”,  
“description”=\>“dfdfdf”, “user\_id”=\>“1”}}
