Topic: Can I improve my design?
I have date of birth of users saved in db. In the view page, The date is converted to select list using the select_date tag, like shown below.
<%= select_date @user.dob.to_date, :prefix => 'dob', :start_year =>
1920, :use_month_numbers => true %>
I'm using the following code in my controller to save the changes made in the list using the following code.
@dobyyear = params[:dob][:year]
@dobmonth = params[:dob][:month]
@dobday = params[:dob][:day]
@dob = @dobmonth.to_s + "/" + @dobday.to_s + "/" + @dobyyear.to_s
person.dob = @dob
Note: There are text fields, that's why the update_attributes
The question is that, even though the code is working right I feel I'm making code so complex. I believe that there is an easy way for this. Can any one advice me on that. Also do I really need a .save and update_attibutes code?
Last edited by chryste (2007-07-21 03:00:35)