Skip to content

Instantly share code, notes, and snippets.

@tothda
Created October 11, 2008 19:34
Show Gist options
  • Save tothda/16314 to your computer and use it in GitHub Desktop.
Save tothda/16314 to your computer and use it in GitHub Desktop.
## 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