Check for birthday before putting in birthday paramaters

This commit is contained in:
Raphael 2010-11-05 18:32:04 -07:00
parent 58c3a4306f
commit 8023b6f344

View file

@ -51,10 +51,11 @@ class PeopleController < ApplicationController
def update
# convert date selector into proper timestamp
birthday = params[:date]
unless [:month, :day, :year].any?{|x| birthday[x].blank?}
params[:person][:profile][:birthday] ||= Date.parse("#{birthday[:year]}-#{birthday[:month]}-#{birthday[:day]}")
if birthday = params[:date]
unless [:month, :day, :year].any?{|x| birthday[x].blank?}
params[:person][:profile][:birthday] ||= Date.parse("#{birthday[:year]}-#{birthday[:month]}-#{birthday[:day]}")
end
end
# upload and set new profile photo