syntax error, unexpected keyword_ensure, waiting at the end of the Ruby And Rails entry

4

Good afternoon Community, I come with this problem from Ruby & Rails I'm a bit of a rookie in the language and this mistake has me dismayed,

The error comes to me in the path app/views/bienvenida/index.html.haml:20 assuming that the number is the line of code, this is what I have in index:

#hello.top-header
  #top.callbacks_container
    %ul#slider4.rslides
      %li
        = image_tag("slide.jpg", :alt => "")
      .caption.text-center
        **.slide-text-info**
          %h1 ! Bienvenidos ¡
          .slide-text-info-btns
          %li
            %a{:href => ""}
              = image_tag("slide.jpg", :alt => "")
              .caption.text-center
                .slide-text-info
                  %h1 Conoce lo más destacado
                  .slide-text-info-btns
          %li
            = image_tag("slide.jpg", :alt => "")
              .caption.text-center
                .slide-text-info
                  %h1 ¿Aun no estas dentro?
                  %a{:href => ""}
                    %h2 ! Unete ¡
                  .slide-text-info-btns
          .clear

What is in bold is line 20 of my code.

To add more information about the project this is what I have in Application.hmtl.haml:

!!!5
%html
  %head
    %title HOW TO!
    = csrf_meta_tags

    %meta{:content => "width=device-width, initial-scale=1", :name => "viewport"}
    %meta{:content => "text/html; charset=iso-8859-1", "http-equiv" => "Content-Type"}

    = stylesheet_link_tag "application", :media => "all"

    = javascript_include_tag "application"
    = javascript_include_tag "jquery.cslider"
    = javascript_include_tag "jquery.flexisel"
    = javascript_include_tag "jquery.min"
    = javascript_include_tag "modernizr.custom.28468"
    = javascript_include_tag "owl.carousel"
    = javascript_include_tag "responsive-nav"
    = javascript_include_tag "responsiveslides.min"

  :javascript
    addEventListener("load", function() { 
      setTimeout(hideURLbar, 0); }, false); 
      function hideURLbar(){ window.scrollTo(0,1); 
    }

  :javascript
    $(function() {
      var pull = $('#pull');
      menu = $('nav ul');
      menuHeight = menu.height();

      $(pull).on('click', function(e) {
        e.preventDefault();
        menu.slideToggle();
      });

      $(window).resize(function(){
        var w = $(window).width();

        if(w > 320 && menu.is(':hidden')) {
          menu.removeAttr('style');
        }
      });
    });

  :javascript
    (function ($) {
      $("#slider4").responsiveSlides({
        auto: true,
        pager: true,
        nav: true,
        speed: 500,
        namespace: "callbacks",
        before: function () {
          $('.events').append("before event fired.");
        },
        after: function () {
          $('.events').append("after event fired.");
        }
      }(jQuery));
    });

  :javascript
    $(function() {
      $('#da-slider').cslider({
        autoplay    : true,
        bgincrement : 450
      });
    });

  :javascript
    $(function() {
      $('#da-slider1').cslider({
        autoplay    : true,
        bgincrement : 450
      });
    });

  %body
    = yield
    
asked by IngErick 06.01.2016 в 23:43
source

1 answer

1

To debuge the view, the first thing you should do is isolate the problem, for which you have to delete blocks of code until the problem is no longer, then go reintroducing the lines little by little until you find where is the error.

On the other hand, there are several issues that I can mark in the code to help you avoid this type of problem, since one of the causes is having very complex views (with a lot of code).

  • In the layout ( application.html.haml ) you call many javascript using javascript_include_tag , that is not necessary to do so, in general it is enough to use the first, the rest of the javascript is incorporated using the asset pipeline ( link ).

    The rest of the javascript you add in the html can also be added there.

  • If you are starting, it is better to use UTF-8, since most libraries expect that encoding and you can find difficult problems to find (this can be one, with that sign of admiration so close). Look at the encoding of the files you use and change the encoding that you declare in the html.

  • Always use the smallest possible code that is understandable, note that you do not gain anything by doing = image_tag("slide.jpg", :alt => "") instead of doing = image_tag "slide.jpg" and that adds noise that makes it hard to find errors.

  • Luck in the hunt.

        
    answered by 01.03.2016 / 04:33
    source