在我项目的一个模块中,我使用了嵌套形式,并且在该嵌套形式中,我想将 wicked 形式与 wicked
参考:Ryan bates http://railscasts.com/episodes/346-wizard-forms-with-wicked?view=asciicast
视图 > 通知 > _form.html.erb
<%= form_for(@notice) do |f|%>
#notice attributes
<%= f.submit, "Next">
<% end %>
我创建了一个 notice_step 控制器,并在该控制器中编写了
class NoticeStepsController < ApplicationController
include Wicked::Wizard
steps :agendaa
def show
@notice = Notice.new
render_wizard
end
end
并在通知控制器中创建操作
def create
@notice = Notice.new(params[:notice])
if @notice.save
session[:notice_id] = @notice.id
redirect_to notice_steps_path
else
render :new
end
end
notice_step > 议程.html.erb
<%= form_for(@notice, url: wizard_path) do |f| %>
< div class="field">
<%= f.fields_for :agendas do |builder| %>
<%= render "notices/agenda_fields", :f => builder %>
<% end %>
<%= link_to_add_fields "Add agenda", f, :agendas %>
< /div>
<% end %>
嵌套模型正在工作.....但是单击下一个按钮时,它会显示以下错误
It is giving me SyntaxError in User_steps#show compile error
/home/kipl/Desktop/cus_notice/app/views/user_steps/agendaa.html.erb:1: syntax error, unexpected ':', expecting ')'
...ppend= form_for(@notice, url: wizard_path) do |f| @output_b...
^
/home/kipl/Desktop/cus_notice/app/views/user_steps/agendaa.html.erb:10: syntax error, unexpected kENSURE, expecting $end
有什么建议么???