I'm having problems, all of a sudden, with some code that's been working for years. Someone else wrote this code, and I'm just trying to maintain it - I don't have expert experience with ruby or rails. The code grabs all invoices processed within the past week for a customer and send an email to the appropriate person, like this:
# finds the most recent invoices for this organization def find_recent_invoices(number=6) date = (Time.now - number.days).to_date invoices.find(:all, :order => 'posted_on asc', :conditions => ["invoices.posted_on >= ?", date]) end I get this error: NoMethodError (private method `to_date' called for Sat Nov 15 13:32:51 -0800 2008:Time): /app/models/organization.rb:67:in `find_recent_invoices' /app/controllers/admin/communicate_controller.rb:96:in `send_invoices' /app/controllers/admin/communicate_controller.rb:95:in `each' /app/controllers/admin/communicate_controller.rb:95:in `send_invoices' /vendor/rails/actionpack/lib/action_controller/base.rb:849:in `send' /vendor/rails/actionpack/lib/action_controller/base.rb:849:in `perform_action_without_filters' /vendor/rails/actionpack/lib/action_controller/filters.rb:332:in `perform_action_without_benchmark' /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue' /usr/lib/ruby/1.8/benchmark.rb:293:in `measure' /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue' /vendor/rails/actionpack/lib/action_controller/rescue.rb:82:in `perform_action' /vendor/rails/actionpack/lib/action_controller/base.rb:369:in `send' /vendor/rails/actionpack/lib/action_controller/base.rb:369:in `process_without_session_management_support' /vendor/rails/actionpack/lib/action_controller/session_management.rb:116:in `process' /vendor/rails/railties/lib/dispatcher.rb:38:in `dispatch' /lib/fcgi_handler.rb:136:in `process_request' /lib/fcgi_handler.rb:62:in `process!' /usr/lib/ruby/1.8/fcgi.rb:612:in `each_cgi' /usr/lib/ruby/1.8/fcgi.rb:609:in `each' /usr/lib/ruby/1.8/fcgi.rb:609:in `each_cgi' /lib/fcgi_handler.rb:53:in `process!' /lib/fcgi_handler.rb:20:in `process!' dispatch.fcgi:24 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---