search for: find_all_by_date

Displaying 2 results from an estimated 2 matches for "find_all_by_date".

2007 Oct 07
22
Differences in execution between console and app
class AppointmentBook < ActiveRecord::Base has_many :appointments def lookup(date, look_ahead = 27) return nil unless block_given? (date..date + look_ahead).each do |date| yield(date, appointments.find_all_by_date(date)) end end end The line with yield is throwing the error: undefined method ''each'' for #<Date: 4908761/2,0,2299161> A YAML dump of date yields: >>> DATE: --- 2007-10-07 (CLASS: Date) However, a very similar line of code works fine in console: appointmen...
2006 Feb 05
1
return yr/mo archive of posts
looking at ways to return an archive, by year/month in the past, (via php) i''d do something like pull all the entries, ordered by date and iterate through them, doing a check on the month and year and adding them to an array if there was a change that method doesn''t really feel very fluid or rails-like. any suggestions?