简体   繁体   中英

syntax error, unexpected keyword_ensure, expecting keyword_end

I currently have this code:

- 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)

and I'm getting this error:

syntax error, unexpected keyword_ensure, expecting keyword_end

I assume it's to do with the indentation but I can't see the problem..

For the if statement, you're doing an assignment with '=', we should use '==' instead.

And I think you need to use 'elsif' instead of 'else if'.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM