From 4a39d1a51617be593b02e3879f0db43aa4953419 Mon Sep 17 00:00:00 2001 From: maxwell <maxwell@joindiaspora.com> Date: Fri, 5 Nov 2010 17:38:51 -0700 Subject: [PATCH] date now has a default nil value --- app/controllers/people_controller.rb | 3 ++- app/models/aspect.rb | 2 +- app/views/people/edit.html.haml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index c8edc77f44..8d0567a76d 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -52,7 +52,8 @@ class PeopleController < ApplicationController def update # convert date selector into proper timestamp birthday = params[:date] - if birthday + + unless [:month, :day, :year].any?{|x| birthday[x].blank?} params[:person][:profile][:birthday] ||= Date.parse("#{birthday[:year]}-#{birthday[:month]}-#{birthday[:day]}") end diff --git a/app/models/aspect.rb b/app/models/aspect.rb index eb216758c3..1fdfd9d5c5 100644 --- a/app/models/aspect.rb +++ b/app/models/aspect.rb @@ -29,7 +29,7 @@ class Aspect def to_s name end - + def person_objects person_ids = people.map{|x| x.person_id} Person.all(:id.in => person_ids) diff --git a/app/views/people/edit.html.haml b/app/views/people/edit.html.haml index e39ee4c14e..f84e950693 100644 --- a/app/views/people/edit.html.haml +++ b/app/views/people/edit.html.haml @@ -34,7 +34,7 @@ %h4 = t('.your_birthday') %br - = select_date @person.profile.birthday, :order => [:month, :day, :year], :start_year => 1930, :end_year => 2000 + = select_date @person.profile.birthday, :prompt => true, :default => true, :order => [:month, :day, :year], :start_year => 1930, :end_year => 2000 %h4 = t('.your_bio') -- GitLab