L
L
lavezzi12015-02-22 15:27:04
Ruby on Rails
lavezzi1, 2015-02-22 15:27:04

How to deal with Ruby syntax?

I use Sublime Text 3 and almost always, when writing, when something like this message pops up

Inconsistent indentation: 11 spaces used for indentation, but the rest of the document was indented using 4 spaces.

Do I need to somehow set up the Sublime workbench itself?
Here is a code like this. How to figure out where you need an indent, and where not? What to read to learn and on what topic to google in general? Thanks
%body
    %header
        .wrapper.clearfix
            #logo= link_to "Muse", root_path
            %nav
                - if user_signed_in?
                    = link_to current_user.name, edit_user_registration_path
                    = link_to "Add New Inspiration", new_post_path, class: "button"
                - else
                    = link_to "Sign In", new_user_session_path
                    = link_to "Sign Up", new_user_registration_path, class: "button"
    %p.notice= notice
    %p.alert= alert

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Vsk, 2015-02-22
@lavezzi1

This is not Ruby syntax. This is HAML
syntax . To understand it, you need to understand HTML . If you constantly have an odd number of spaces, then you either put them manually (not tabs) or copy them from different sources. Actually, it's a matter of habit. If inconvenient, use regular ERB. With the help of e.g. - https://github.com/haml/html2haml - one can translate all HAML to ERB

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question