<%=
distance_of_time_in_words_to_now(order.created_at, :include_seconds =>
true) %> ago
<% end %>
I have it in HAML as:
%ul= @orders.each do |order|
%li
%span.pull-2.box= “#{leading_zeros order.id}”
= link_to “#{order.name}”, order, :remote => true
%span.rightside= link_to ‘Delete’, order, :confirm => ‘Are you sure?’,
:method => :delete
%li.time_space
%span.quiet.small.time=
{distance_of_time_in_words_to_now(order.created_at, :include_seconds =>
true)} ago
= end
I’m not sure how to correct this. Any help on formatting the ruby code
would be greatly appreciated. That’s where it seems to fail on me. I
have multiple spans on the same line in ERB. Should I do each span on
its own line?
<%=
distance_of_time_in_words_to_now(order.created_at, :include_seconds =>
true) %> ago
<% end %>
----
I have it in HAML as:
%ul= @orders.each do |order|
%li
%span.pull-2.box= “#{leading_zeros order.id}”
= link_to “#{order.name}”, order, :remote => true
%span.rightside= link_to ‘Delete’, order, :confirm => ‘Are you sure?’,
:method => :delete
%li.time_space
%span.quiet.small.time=
{distance_of_time_in_words_to_now(order.created_at, :include_seconds =>
true)} ago
= end
That’s not even close to right. You need to learn about the use of -
instead of = in Haml. Reread the language reference.
I’m not sure how to correct this. Any help on formatting the ruby code
would be greatly appreciated. That’s where it seems to fail on me. I
have multiple spans on the same line in ERB. Should I do each span on
its own line?
Yes. Haml has no notion of multiple elements on one line. If white
space is an issue, you can use Haml’s < and > modifiers – or include
bits of HTML or ERb if you really need to (it is occasionally
necessary to do so).