-
-
Save sapient/1330847 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ree-1.8.7-2011.03 :001 > GolfBall.without_dimples | |
NameError: undefined local variable or method `dimples' for #<Class:0xc0c0290> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GolfBall < ActiveRecord::Base | |
has_many :dimples, :dependent => :destroy | |
named_scope :without_dimples, :conditions => lambda {|g| g.dimples.size == 0} | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GolfBall < ActiveRecord::Base | |
has_many :dimples, :dependent => :destroy | |
named_scope :without_dimples, :conditions => g.dimples.size == 0 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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