0

In my lib/tasks/populate.rake file I have to write some hard coded data in proper html format with proper alignment. How can I write it in the populate file? Is there any way to parse the HTML tags after writing?For random data I know there is populator gem. But I want some hard coded data. Please some help me out.

Sneha Kachroo
  • 583
  • 2
  • 6
  • 12

2 Answers2

0

First write html data inside html file then align and validate file. If everything is write then copy html data inside file to lib/tasks/populate.rake file. There are many online tools that can do validation. http://validator.w3.org/

Sandip Ransing
  • 7,583
  • 4
  • 37
  • 48
0

You need to use Ruby heredoc syntax to align your code

text = <<END
<p>Whatever you want to write in whatever form</p>
               line with spaces in front
        Another indented line
Account No. : XYZ
END

text = text.html_safe

There should be no spaces before the closing END.

Kulbir Saini
  • 3,926
  • 1
  • 26
  • 34