Created
May 31, 2012 22:28
-
-
Save radar/2846774 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # current_account.time_blocks.recently_updated | |
| # result -> lots of records | |
| # current_account.appointments.recently_updated | |
| # result -> NoMethodError Exception: undefined method `recently_updated' for #<Class:0x007fe6a7a13ef8> | |
| class Appointment < ActiveRecord::Base | |
| belongs_to :time_block | |
| scope :recently_updated, includes(:time_block).where("time_blocks.updated_at > ?", 5.days.ago).order("time_blocks.updated_at desc").limit(50) | |
| end | |
| class TimeBlock < ActiveRecord::Base | |
| has_one :appointment | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment