Rails 3 Nested Models unknown attribute Error

前端 未结 4 1996
时光取名叫无心
时光取名叫无心 2021-01-03 03:49
  • I have a model \"Issue\" and a nested Model \"Relationship\"
  • In the issue.rb I have mentioned:

    has_many :relationships, :dependent => :d         
    
    
            
4条回答
  •  耶瑟儿~
    2021-01-03 04:30

    I assume you are constructing the relationship in your controller and then trying to use it in the view. In order for this to be visible, you must make it an instance variable. All you need to do is throw an @ symbol in from of the name of relationship, as you have done with @issue.

    @relationship = @issue.relationships.build
    

    Edit: due to further information provided by the OP after the original question was asked, this answer is now clearly not applicable.

提交回复
热议问题