accepts_nested_attributes_for called twice in model
class StepQuiz < ActiveRecord::Base
belongs_to :step
has_many :开发者_开发问答step_quiz_questions, :dependent => :destroy
accepts_nested_attributes_for :step
accepts_nested_attributes_for :step_quiz_questions, :allow_destroy => true
attr_accessible :step_id, :instructions, :correct_to_pass, :retakes_allowed, :time_limit, :step_attributes, :step_quiz_questions_attributes
end
Am I allowed to have accepts_nested_attributes_for called twice for a given model. It appears to work with no errors.
You are using a class method defined here: http://api.rubyonrails.org/classes/ActiveRecord/NestedAttributes/ClassMethods.html
The answer is yes, so that you can tune every single case.
精彩评论