Skip to content

Instantly share code, notes, and snippets.

@knewter
Created December 20, 2011 18:57
Show Gist options
  • Save knewter/1502764 to your computer and use it in GitHub Desktop.
Save knewter/1502764 to your computer and use it in GitHub Desktop.
class Foo < ActiveRecord::Base
scope :bar, lambda{|a| where(a: a) }
scope :baz, lambda{|b| where(b: b) }
end
# Foo.bar(a).baz(b) works fine.
class Foo < ActiveRecord::Base
class << self
def bar(a)
where(a: a)
end
def baz(b)
where(b: b)
end
end
end
# What does Foo.bar(a).baz(b) do here? seems like it wouldn't work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment