0

我目前有这个代码:

- if @ue.id = 1

  = form_tag("/about-us/upcoming-events/process", :id => "theoneform") do
    %table.cellone
      %input{ :type => "hidden", :value => "#{ @ue.title }", :name => "upcoming_event" }
      %input{ :type => "hidden", :value => "#{ @ue.campaign_id }", :name => "campaign_id"}
      %input{ :type => "hidden", :value => "#{ @ue.date }", :name => "event_date" }


      - "1,2,3,4,19,20,260, 263, 265,237,45".split(",").each do |ff3|
        = raw make_me_a_field(ff3, @form_info)

- else if @ue.id = 6

  = form_tag("/about-us/upcoming-events/process", :id => "theoneform") do
    %table.cellone
      %input{ :type => "hidden", :value => "#{ @ue.title }", :name => "upcoming_event" }
      %input{ :type => "hidden", :value => "#{ @ue.campaign_id }", :name => "campaign_id"}
      %input{ :type => "hidden", :value => "#{ @ue.date }", :name => "event_date" }


      - "1,2,3,4,19,20,260,237,45".split(",").each do |ff3|
        = raw make_me_a_field(ff3, @form_info)

我收到了这个错误:

syntax error, unexpected keyword_ensure, expecting keyword_end

我认为这与缩进有关,但我看不出问题..

4

1 回答 1

1

对于 if 语句,您正在使用 '=' 进行赋值,我们应该使用 '==' 代替。

而且我认为您需要使用“elsif”而不是“else if”。

于 2012-10-18T16:40:49.663 回答