Good afternoon Community, I come with this Ruby & Rails problem. I am a bit new to the language and this error has me dismayed,
I get the error in the route 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
To debug the view, the first thing you would have to do is isolate the problem, for which you have to eliminate blocks of code until the problem is no more, and then reintroduce the lines little by little until you find where the error is.
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 throughjavascript_include_tag
, it is not necessary to do it like that, in general it is enough to use the first one, the rest of the javascript is incorporated using the asset pipeline ( http://guides.rubyonrails.org/asset_pipeline.html ) .The rest of the javascript that you add in the html can also be added there.
If you're just starting out, it's best to use UTF-8, since most libraries expect that encoding and you may run into hard-to-find problems (this may be one, with that exclamation mark so close). Look at the encoding of the files you use and change the encoding 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 difficult to find errors.Good luck on the hunt.