All blog articles by Supriya Laxman Medankar
E906aa73e06c1a50e35138fe54bec0c7
Supriya Laxman Medankar

In one of app we are sending multiple PDFs as attachment, so instead of sending individual file we decided to send all PDFs in zip. I found a gem 'Rubyzip', to create temporary zip archive and send it as attachment.

Rubyzip is a ruby liabrary to reading and writing zip file.

To create a zip and send it as attachment using Rubyzip here’s a simple example:

  1. Add gem in gemfile

    gem 'rubyzip'
    
  2. Write function to create zip file:

    def get_zip_data
     zip_file =...

Read complete blog post

Now a days in many website we use chart to show the statistics for the site and there are many plugins and gems available for it. But I liked one gem Chartkick that I used in one of our application to create column chart to show weekly, yearly and From date - ToDate range statistics of site. I found it very useful and easy to use. You will get details about chartkick here.

To use chartkick you have to just follow simple step and you are ready to create beautiful Javascript charts with one...

Read complete blog post

E906aa73e06c1a50e35138fe54bec0c7
Supriya Laxman Medankar

In Rails 5 Active Record provide two finder methods to specify JOIN on associated tables,

 `joins`
 `left_outer_joins`

Suppose in our application we have Article and Comment. Here comments belong to an article, while article have many comments. Now if we want to show list of all articles along with number of comments, we need join to Article and Comment by left_outer_join.

In rails 4.x, Active Record does not have support for outer joins. So we need to add SQL for left outer...

Read complete blog post

E906aa73e06c1a50e35138fe54bec0c7
Supriya Laxman Medankar

Wicked PDF uses shell utility wkhtmltopdf to serve a PDF file to a user from HTML. In other words, you simply write an HTML view as you would normally, then wicked PDF takes care of other stuff. wicked PDF works on Ruby versions 1.8.7 through 2.3; Rails 2 through 5.0

Installation:

To use Wicked PDF, first install wkhtmltopdf. Alternatively, you could use the wkhtmltopdf-binary gem by including it in your Gemfile.

Add following gems to your Gemfile and run bundle install.

gem...

Read complete blog post