Skip to content

Instantly share code, notes, and snippets.

@jimhj
Created November 15, 2012 05:35
Show Gist options
  • Save jimhj/4076825 to your computer and use it in GitHub Desktop.
Save jimhj/4076825 to your computer and use it in GitHub Desktop.
Uncache query in ActiveRecord
def self.get_responded_inquiry(mobile_no, company_id)
uncached do
self.find(:last, :conditions => ["mobile_no = ? and company_id = ? and response_status = 1", mobile_no, company_id])
# self.find_all_by_mobile_no_and_company_id_and_response_status(mobile_no, company_id, 1).last
end
end
def self.last_req(mobile_no, company_id)
uncached do
self.find(:last, :conditions => ["mobile_no = ? and company_id = ?", mobile_no, company_id])
# self.find_all_by_mobile_no_and_company_id(mobile_no, company_id).last
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment