ruby on rails - HAML: Got "elsif" with no preceding "if" -
i need construction in haml code:
- if @organisation.type == 'company' %p %strong number of employees: = @organisation.number_of_employees - elsif @organisation.type == 'educationalinstitution' %p %strong number of students = @organisation.number_of_students
but syntax error: got "elsif" no preceding "if" how must update code solve error?
your indentation looks might issue
- if @organisation.type == 'company' %p %strong number of employees: = @organisation.number_of_employees - elsif @organisation.type == 'educationalinstitution' %p %strong number of students = @organisation.number_of_students
bonus indenting quirk
the if/else statement fail if commenting not adhere correct indentation.
e.g.
- if @organisation.type == 'company' %p %strong number of employees: = @organisation.number_of_employees -# institutional case - elsif @organisation.type == 'educationalinstitution' %p %strong number of students = @organisation.number_of_students
will fail.
- if @organisation.type == 'company' %p %strong number of employees: = @organisation.number_of_employees - elsif @organisation.type == 'educationalinstitution' -# institutional case %p %strong number of students = @organisation.number_of_students
will correct.
Comments
Post a Comment