Skip to content

Instantly share code, notes, and snippets.

@jessedearing
Forked from dwarfmondo/module_example.rb
Created December 17, 2010 22:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jessedearing/745862 to your computer and use it in GitHub Desktop.
Save jessedearing/745862 to your computer and use it in GitHub Desktop.
module Scopes
attr_writer :church_id
# evaluates to
# instance_eval do
# def church_id
# @church_id
# end
# def church_id=(value)
# @church_id = value
# end
# end
end
class User < ActiveRecord::Base
include Scopes
def find
self.find(:first, :conditions => ["church_id = ?", church_id])
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment