search for: find_all_by_xxx

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

2006 Apr 13
2
Automatic finder
It looks rails automatically creates a "finder" method on models that have a "belongs_to". So I tried this in the console: c = Category.find(2) chunks = Chunk.find_by_category(c) chunks is always returned as an empty array. When I know have some chunks with a category_id of 2. Should the find_by_category do what I think it should be doing or am I completely off base?
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