我收到了这个错误:
undefined method `create_postconversation' for #<Post...>
......源于这一行:
posts_controller.rb
@postconversation = @post.create_postconversation
我做错了什么?
post.rb
has_one :postconvo, foreign_key: "post_id", dependent: :destroy
has_one :postconversation, through: :postconvo,
class_name: "Conversation",
source: :conversation
postconvo.rb
belongs_to :post
belongs_to :conversation
validates :post_id, presence: true
validates :conversation_id, presence: true
conversation.rb
has_one :postconvo, foreign_key: "conversation_id", dependent: :destroy
has_one :post, through: :postconvo, source: :post