Reputation: 191
My field_for is throwing a syntax error i dont know why? How am i suppose to indent this?
Inconsistent indentation: "\t " used for indentation, but the rest of the document was indented using 1 tab.
= form_for(:contacts, url: contacts_path) do |f|
= f.error_messages
= f.label :subject, "Name"
%span{style: 'color: red'} *
= f.text_field :subject, class: "text_field width_100_percent"
%br
%br
= f.label "Email"
%span{style: 'color: red'} *
%br
= f.email_field :email, class: "text_field width_100_percent"
%br
%br
= f.label "Phone"
%br
= f.fields_for :custom_field do |cust|
= cust.text_field :phone_number_28445
%br
%br
= f.label "Question(s), and/or feedback"
%span{style: 'color: red'} *
%br
= f.text_area :description, class: "text_field width_100_percent", style: 'height: 100px;'
%br
%br
= f.submit "Submit", class: 'btn btn-warning'
I know its my field_for because as soon as i take it out the form works again
Upvotes: 0
Views: 568
Reputation: 2785
if you are defining any field in side a span use one tab like %span{style: 'color: red'} * = f.text_field :subject, class: "text_field width_100_percent" i guess it will be helpful and try to use any ide to format your code because it seems like a code formatting and indentation problem
Upvotes: 1
Reputation: 550
I've dealt with this before. It can be a pain. Usually happens if you've copied and pasted code from another IDE then modify part of the file.
As the error says, you've indented that line with a tab, plus two spaces whereas the rest of the file is indented just with just tabs. Some IDEs will insert two spaces when you enter a tab instead of actually inserting a tab. Check your editor's settings, or replace the indentation on the other lines such that everything is indented with 2 spaces replacing each tab.
Upvotes: 1