Created
October 11, 2008 19:34
-
-
Save tothda/16314 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
## post.rb | |
class Post < ActiveRecord::Base | |
has_many :comments | |
def after_initialize | |
comments.first | |
end | |
end | |
## comment.rb | |
class Comment < ActiveRecord::Base | |
belongs_to :post | |
def after_initialize | |
puts "post.id = #{post.id}" | |
end | |
end | |
## irb session | |
>> Post.first | |
ActiveRecord::StatementInvalid: SystemStackError: stack level too deep | |
# FUCK !!! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment