Tag: haml formtastic

为什么accepts_nested_attributes_for不适合我? (铁轨3)

我在Rails 3应用程序上使用formtastic和haml。 我正在尝试为调查和问题制作一个嵌套表格,但这对我不起作用。 我已经看过railscast以及它和所有内容,但我似乎无法使它适用于我的应用程序。 所以现在,我有以下内容: 楷模 class Survey :destroy, :autosave => true accepts_nested_attributes_for :questions, :allow_destroy => true end class Question :destroy attr_accessible :q_text, :order, :q_type end 相关控制器方法 def update @survey = Survey.find(params[:id]) @user = current_user if check_auth_and_redirect @user, @survey if @survey.update_attributes(params[:survey]) flash[:success] = “Survey Updated” redirect_to edit_survey_path(@survey) else @title = “Editing Survey #{@survey.id}” render ‘edit’ […]