Skip to content

Instantly share code, notes, and snippets.

@sapient
Forked from chewmanfoo/2nd_try_result.rb
Created November 1, 2011 15:37
Show Gist options
  • Save sapient/1330847 to your computer and use it in GitHub Desktop.
Save sapient/1330847 to your computer and use it in GitHub Desktop.
ree-1.8.7-2011.03 :001 > GolfBall.without_dimples
NameError: undefined local variable or method `dimples' for #<Class:0xc0c0290>
class GolfBall < ActiveRecord::Base
has_many :dimples, :dependent => :destroy
named_scope :without_dimples, :conditions => lambda {|g| g.dimples.size == 0}
end
class GolfBall < ActiveRecord::Base
has_many :dimples, :dependent => :destroy
named_scope :without_dimples, :conditions => g.dimples.size == 0
end
ree-1.8.7-2011.03 :001 > GolfBall.without_dimples
ActiveRecord::StatementInvalid: Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1: SELECT * FROM `golf_balls` WHERE (#<Proc:0x0c4f0950@/home/path/golf_ball.rb:27>)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment