Skip to content

Instantly share code, notes, and snippets.

@jeremyolliver
Created June 27, 2013 23:08
Show Gist options
  • Save jeremyolliver/5881192 to your computer and use it in GitHub Desktop.
Save jeremyolliver/5881192 to your computer and use it in GitHub Desktop.
class Account < ActiveRecord::Base
scope :open, where(:closed => false)
end
class Group < ActiveRecord::Base
has_many :accounts
end
=> Account.open
Account Load (0.6ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`closed` = 0
=> []
=> g = Group.first
=> g.accounts.open
ArgumentError: wrong number of arguments (0 for 1)
from ~/.rbenv/versions/1.9.3-p392/lib/ruby/1.9.1/open-uri.rb:27:in `open'
from ~/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/activerecord-3.1.12/lib/active_record/associations/collection_proxy.rb:108:in `method_missing'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment