# \[Rails 3\] How to refer to birthday(1i) in a AR

**URL:** <https://www.ruby-forum.com/t/rails-3-how-to-refer-to-birthday-1i-in-a-ar/189675>\
**Category:** Rails\
**Created:** [June 4, 2010, 11:15pm UTC](https://www.ruby-forum.com/t/rails-3-how-to-refer-to-birthday-1i-in-a-ar/189675 "2010-06-04T23:15:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ShellScripter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/958977/32.png) [@ShellScripter](https://www.ruby-forum.com/u/ShellScripter)\
**Post date:** [June 4, 2010, 11:15pm UTC](https://www.ruby-forum.com/t/rails-3-how-to-refer-to-birthday-1i-in-a-ar/189675/1 "2010-06-04T23:15:13Z")

</div>

Hi , there , first of all i wanna to express my regard to the Rails 3  
dev. team’s effort ,  
the work is really amazing ! Really speed up a lot the performance !!

Well , i still a rookie guy and have a question for ask T\_T :

i have two association ARs : User has\_one Account , and i have used  
the  
accepts\_nested\_forms for get all create up for only one line of code  
in view  
: @user = User.new(params[:user]

until this part i have done with the tutorial of RailsCast

> **[\#196 Nested Model Form Part 1 - RailsCasts](http://railscasts.com/episodes/196-nested-model-form-part-1)**
>
> Short Ruby on Rails screencasts containing tips, tricks and tutorials. Great for both novice and experienced web developers.

However , in my Account AR , there is a birthdate colum ,  
( t.date :birthdate in the migration)  
, i have used the date\_select helper to generate the corresponding  
html code , and  
get the return values : year , month , day with birthday(1i) ,  
birthday(2i) , birthday(3i)  
, i have tried to use the virtual attribute in the Account AR for  
combine all these values ,  
but i can’t refer them with  
attr\_accessor :“birthday(1i)”, :“birthday(2i)” , :“birthday(3i)”.

I don’t know if there is another solution for kind of this , or  
another way to get my objective:  
get date(year, month, day) from html and combine name all in a  
birthday value for save @\_@??

Thx in advance !

---

<div class="post-metadata">

**Author:** ![ShellScripter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/958977/32.png) [@ShellScripter](https://www.ruby-forum.com/u/ShellScripter)\
**Post date:** [June 5, 2010, 12:31pm UTC](https://www.ruby-forum.com/t/rails-3-how-to-refer-to-birthday-1i-in-a-ar/189675/2 "2010-06-05T12:31:21Z")

</div>

On Jun 4, 9:59 pm, ShellScripter [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 

You shouldn’t need to - as long as you use date\_select (with the  
attribute name birthdate) and then pass that into User.new (or  
User.update\_attributes etc.) activerecord will do the work of sticking  
the individual parameters back together to get a Date object

Fred

---

<div class="post-metadata">

**Author:** ![ShellScripter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/958977/32.png) [@ShellScripter](https://www.ruby-forum.com/u/ShellScripter)\
**Post date:** [June 8, 2010, 1:27pm UTC](https://www.ruby-forum.com/t/rails-3-how-to-refer-to-birthday-1i-in-a-ar/189675/3 "2010-06-08T13:27:22Z")

</div>

Thx a lot , that’s true , it just was my mistake …  
:o
