Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby haml unexpected ending error

= simple_form_for @pin, html: { multipart: true} do |f|
- if @pin.errors.any?
    #errors
        %h2
        = pluralize(@pin.errors.count, "errors")
        prevented this Pin from saving
        %ul
            - @pin.errors.full_messages.each do |msg|
            %li= msg
.form-group
    = f.input :title, input_html: { class: 'form-control' } 

.form-group
    = f.input :description, input_html:{ class: 'form-control' }     

= f.button :submit, class: "btn btn-primary"    

can someone tell me why this is returing me the error that says below for rails

/Users/frankchen/project/pin_board/app/views/pins/_form.html.haml:17: syntax error, unexpected keyword_ensure, expecting keyword_end ...:Util.html_safe(_erbout);ensure;@haml_buffer = @haml_buffer.... ... ^ /Users/frankchen/project/pin_board/app/views/pins/_form.html.haml:20: syntax error, unexpected end-of-input, expecting keyword_end

like image 341
frankcrest Avatar asked Jan 17 '26 02:01

frankcrest


1 Answers

If it's HAML, it's more than likely an indentation issue. I can't match up the line number you provided since we're only seeing a snippet of the code, but I'm guessing that the indentation between these two lines is off:

- @pin.errors.full_messages.each do |msg|
%li= msg
like image 191
Matt Huggins Avatar answered Jan 19 '26 18:01

Matt Huggins



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!