In PHP, we have a pre defined function nl2br which converts newlines to <br/> tag. Unfortunately we don’t have a function in Ruby similar to nl2br. We have to create a user defined function. Example function for nl2br def nl2br(string) string = string.gsub(/(\r)?\n/, ” “) return string end Thats it. Happy Coding! Cover Image: Ruby […]
Tag: Ruby On Rails
Error: PDF could not be generated! Command Error: QSslSocket: cannot resolve CRYPTO_num_locks in wkhtmltopdf or Pdfkit – Solved
QSslSocket Issue The following issue raised while creating pdf using these libraries wkhtmltopdf_binary, wkhtmltopdf, PdfKit. Reason for issues: The above issue may be occurred for any one the following reasons. Recently you may be downgraded some libraries or removed it. You might be tried to install the latest version of ruby through rvm, but failed […]
Change the cell format as MM/DD/YYYY in Spreadsheet gem on Ruby On Rails
Change the cell format with the following simple example. Create the local variable using Spreadsheet::Format.new then assign it to the particular column as default_fomat. Here in my example states as column(1) means that is changing the second column as the date format. Sample Code: Reference: spreadsheet.rubyforge.org/
throws libcrypt.so.1 library missing error after upgrading Fedora 30
It is May 2019, Fedora Released their latest version 30.This update has provided many features such us GNOME 3.32 which gives brand new look Performance improved much Linux Kernal 5 However we were facing some issues while upgrading from Fedora 29 to Fedora 30. It breaks the already installed Ruby. Fedora 30 have included the […]
Convert data-url to Image file in Ruby on Rails – Learn Easily
What is Data URL? Data URL is basically base64 encoded content inlined in place of an image tag. If we discuss about it in Depth, it requires full chapter. Will explain it completely in another post. Format for data url: Below is a simple code snippet to convert data url into image file using RoR…all you […]