Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## the problem
- class AuditLog < ActiveRecord::Base
- belongs_to :developer, :validate => true
- belongs_to :unvalidated_developer, :class_name => 'Developer'
- end
- log = AuditLog.new(:message => "")
- log.developer = 1
- log.unvalidated_developer = 2
- # log.developer_id is 1.
- ## source of discovery:
- class ForumPost < ActiveRecord::Base
- belongs_to :author, :class_name => "User"
- end
- class ForumThread < ActiveRecord::Base
- has_many :forum_posts
- attr_accessor :body, :author
- after_create :create_initial_post
- def create_initial_post
- post = forum_posts.new(:body => body, :author => author)
- # omg post.user_id is nil!
- end
- end
Add Comment
Please, Sign In to add comment