Search code examples
htmlruby-on-railsrubyslim-lang

Text and ruby on one line using SLIM


I keep writing markup that looks like this:

span.label.label-default
   span < 
   span= (@today - 1.day).strftime("%e %B, %Y")

Supposed to come out looking like: < 2 May, 2015. I suppose I could write

span.label.label-default= "< #{(@today - 1.day).strftime('%e %B, %Y')}"

Is there a more optimal way to include text and ruby inside the same html tag?


Solution

  • Why not this:

    span.label.label-default= (@today - 1.day).strftime("< %e %B, %Y")