0

私のプロジェクトの 1 つのモジュールでは、ネストされたフォームを使用しましたが、そのネストされたフォームでは、邪悪なフォームで邪悪なフォームを使用したいと考えています。

参考:ライアン・ベイツ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



助言がありますか???

4

1 に答える 1

0

ハッシュ ( :) のコロン表記は、Ruby 1.9 専用です。
ロケット表記 ( =>) を使用する必要があります。

于 2012-06-28T13:21:30.697 に答える