Maybe you shouldn't put business model in your view:
=> Person.rb def self.find_upcoming_birthdays find_all(:conditions => "birthdate is NOT NULL") end
def <=>(other) birthdate.strftime("%j").to_i <=> other.birthdate.strftime("%j").to_i end
def age ((Date.today - birthdate)/365.2422).to_i end
=> _upcoming_birthdays.rhtml <table> <% @upcoming_birthdays.each do |upcoming_birthday| %> <tr> <td> <strong><%= link_to "#{upcoming_birthday.name}", :controller => 'people', :action => 'show', :id => upcoming_birthday %></strong><br /> <%= upcoming_birthday.birthdate.strftime("%B %d") %><br /> <em>will be pluralize(upcoming_birthday.age + 1,'year') old</em><br /> </td> </tr> <% end %> </table>
=> Controller @upcoming_birthdays = Person.find_upcoming_birthdays @upcoming_birthdays.delete_if {|person| Time.today.strftime("%j").to_i > person.birthdate.strftime("%j").to_i } @upcoming_birthdays.delete_if {|person| person.birthdate.strftime("%j").to_i > (Time.today.strftime("%j").to_i) + 31 }
@upcoming_birthdays.sort!
Just my $0.02.