ActiveAdmin with has_many problem; undefined method 'new_record?'

前端 未结 2 2006
暗喜
暗喜 2020-12-24 10:05

I\'m trying to customise a ActiveAdmin form for a Recipe model that has a has_many relationship with Step.

class Recipe < ActiveRecord::Base
  has_many :s         


        
相关标签:
2条回答
  • 2020-12-24 10:45

    go to your Recipe model and add the following line

    accepts_nested_attributes_for :steps
    

    The line is required by formtastic, not active admin. Check https://github.com/justinfrench/formtastic for formtastic documentation

    0 讨论(0)
  • 2020-12-24 10:48
    class Recipe < ActiveRecord::Base
    
        attr_accessible :step_attributes
    
        has_many :steps
    
        accepts_nested_attributes_for :steps
    
    end
    
    0 讨论(0)
提交回复
热议问题