<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mitesh Thakkar on Medium]]></title>
        <description><![CDATA[Stories by Mitesh Thakkar on Medium]]></description>
        <link>https://medium.com/@mj.thakkar97?source=rss-f4bac123431a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*hw1r56-1i8kpDC7JH0zIZw.jpeg</url>
            <title>Stories by Mitesh Thakkar on Medium</title>
            <link>https://medium.com/@mj.thakkar97?source=rss-f4bac123431a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 22:00:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mj.thakkar97/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[ From Segfaults to Sass Salvation: My Journey Migrating Rails 6 to 8 with Dart Sass & Propshaft]]></title>
            <link>https://medium.com/@mj.thakkar97/from-segfaults-to-sass-salvation-my-journey-migrating-rails-6-to-8-with-dart-sass-propshaft-ffeedf82ecbb?source=rss-f4bac123431a------2</link>
            <guid isPermaLink="false">https://medium.com/p/ffeedf82ecbb</guid>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[dart-sass]]></category>
            <category><![CDATA[legacy-systems]]></category>
            <category><![CDATA[esbuild]]></category>
            <dc:creator><![CDATA[Mitesh Thakkar]]></dc:creator>
            <pubDate>Thu, 17 Jul 2025 11:06:40 GMT</pubDate>
            <atom:updated>2025-07-17T11:06:40.199Z</atom:updated>
            <content:encoded><![CDATA[<p>Migrating a legacy Rails application is never just about updating the version number; it&#39;s also about understanding the underlying structure and making informed decisions to ensure a seamless transition. It’s a rabbit hole — a journey through deprecations, breaking changes, compiler quirks, and existential dread. Here’s how I migrated a Rails 6 application to Rails 8, encountered a dreaded segfault from Sass-Rails, and ultimately found peace with Dart Sass, Propshaft, and page-specific SCSS using ESBuild.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*jkjZ7UlKuBGTB-Hg" /></figure><h3>📍 Chapter 1: The Rails 6 → 8 Upgrade Begins</h3><p>It all started innocently. I was upgrading our monolith from <strong>Rails 6 to Rails 8</strong>, aiming for better performance, new features, and long-term support.</p><p>The app used <strong>Sprockets</strong> with <strong>sass-rails</strong>, and everything was stitched together with require_tree and @import. A familiar, yet aging pattern.</p><p>“Let’s modernize everything while we’re here,” I thought.</p><h3>🧱 Chapter 2: Enter Docker &amp; The Great Segfault</h3><p>As I Dockerized the app for smooth deployments, things started to fall apart — particularly during bundle install and asset compilation.</p><p><strong>💥 SEGFAULT.<br></strong> From inside my Docker container.<br> Consistently.<br> No clear reason.</p><p>After some digging, I found the culprit: sass-rails. And then I tried sassc-rails, hoping it would solve things by relying on libsass.</p><p>But…</p><p>❌ <strong>Still segfaulting.</strong></p><p>Turns out, <strong>Ruby 3.3</strong> (which we were using) introduced <strong>YJIT</strong>, and libsass was deprecated and incompatible. I was running a modern Ruby on an outdated stack.</p><h3>🔥 Chapter 3: The Death of Sprockets</h3><p>That’s when I realized: both <strong>Sprockets</strong> and <strong>Ruby-based Sass</strong> were dying. Their maintainers had moved on. Rails core itself had begun pushing <strong>Propshaft</strong> as a simpler, modern replacement.</p><p>I dropped the following gems from my Gemfile:</p><pre>gem &#39;sass-rails&#39;<br>gem &#39;sprockets-rails&#39;<br>gem &#39;sprockets&#39;</pre><p>And added:</p><pre>gem &#39;propshaft&#39;</pre><p>Then in config/application.rb, I swapped:</p><pre># require &quot;sprockets/railtie&quot;<br>require &quot;propshaft/railtie&quot;</pre><p>The asset pipeline was reborn.</p><h3>✂️ Chapter 4: Dart Sass via Yarn Build</h3><p>Since Dart Sass is <strong>not available as a Ruby gem</strong>, I wired up <strong>Yarn and ESBuild</strong> to handle my SCSS files.</p><p>Old style:</p><pre>@import &quot;variables&quot;;<br>@import &quot;header&quot;;</pre><p>New style (Dart Sass):</p><pre>@use &quot;variables&quot; as *;<br>@use &quot;header&quot;;</pre><p>I updated <em>the application.scss</em>, replaced / with math.div(), and used:</p><pre>@use &quot;sass:math&quot;;<br>padding: math.div(10px, 2);</pre><p>Everything should’ve worked.</p><h3>🧩 Chapter 5: Page-Specific Styles — The Hidden Villain</h3><p>But something was still broken.</p><p>My app was heavily dependent on <strong>page-specific stylesheets</strong>, like:</p><pre>= stylesheet_link_tag &quot;pages_scss/#{controller_name}-#{action_name}&quot;, media: &quot;all&quot;</pre><p>Propshaft didn’t auto-load styles like Sprockets did. Dart Sass didn’t support glob imports. And my single <em>application.scss</em> approach wasn’t cutting it.</p><p>This was the real blocker.</p><h3>⚙️ Chapter 6: ESBuild + Page-Specific SCSS</h3><p>The breakthrough came when I realized:</p><p>“Why not compile each page-specific SCSS file separately via ESBuild?”</p><p>So I structured my SCSS like this:</p><pre>app/assets/stylesheets/pages_scss/<br>├── users-show.scss<br>├── orders-index.scss<br>└── …</pre><p>And in my JS build process (yarn build), I compiled them individually using <strong>ESBuild + Dart Sass</strong>.</p><p>Each page got its own CSS bundle again, and my old layout logic stayed intact.</p><h3>✅ Chapter 7: Final Touches</h3><h3>Things I cleaned up:</h3><ul><li>Deleted app/assets/config/manifest.js</li><li>Removed all //= require directives</li><li>Ensured all fonts &amp; images were manually referenced via Propshaft paths</li><li>Reorganized SCSS into base/, components/, layout/, etc.</li></ul><h3>Commands I used:</h3><p><strong>bash:</strong></p><pre>yarn build<br>bin/dev<br>RAILS_ENV=production bin/rails assets:clobber<br>RAILS_ENV=production bin/rails assets:precompile</pre><p>Everything worked. No segfaults. No deprecated gems. Just clean builds.</p><h3>🎉 Chapter 8: What I Learned</h3><ul><li><strong>Modern Rails prefers simplicity.</strong></li><li>Don’t fight Dart Sass — embrace its strictness.</li><li>Page-specific SCSS is possible — just not automatic.</li><li>ES-Build is your friend.</li><li>Sprockets had a good run, but Propshaft is the future.</li></ul><h3>📦 Final Stack</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*aNsPUtQhv-aj5foqidx5vg.png" /></figure><h3>✨ In Retrospect</h3><p>This was more than a migration — it was a detox.</p><p>I removed the project&#39;s deprecated technology, addressed cryptic compiler errors, and rewrote the build pipeline, resulting in a modern, lean, and fast Rails setup.</p><p>If you’re starting your migration journey, don’t just patch the symptoms — fix the ecosystem. Propshaft + Dart Sass isn’t just a new toolchain — it’s a new mindset.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ffeedf82ecbb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Generating QR code with Ruby on Rails]]></title>
            <link>https://medium.com/@mj.thakkar97/generating-qr-code-with-ruby-on-rails-85d5c345afc7?source=rss-f4bac123431a------2</link>
            <guid isPermaLink="false">https://medium.com/p/85d5c345afc7</guid>
            <dc:creator><![CDATA[Mitesh Thakkar]]></dc:creator>
            <pubDate>Mon, 03 Jun 2024 05:16:36 GMT</pubDate>
            <atom:updated>2024-06-03T07:05:50.285Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*0tqseTlQ_ky8GOb93Xwv1g.jpeg" /></figure><p>In today’s digital age, sharing contact details has become more efficient with the use of QR codes. In this blog post, we’ll walk through a Ruby service that generates a QR code encoding contact details in the vCard format. This service leverages the power of the RQRCode and Vcard gems.</p><blockquote>Why Use QR Codes for Contact Details?</blockquote><p>QR codes provide a quick and easy way to share information. By scanning a QR code, users can instantly access your contact details without manually typing them. This is particularly useful for business cards, email signatures, and networking events.</p><blockquote>Introducing the QrContactDetailsService Class</blockquote><p>The QrContactDetailsService class is designed to create a QR code from a user&#39;s contact details. Let&#39;s dive into the code and understand how it works.</p><blockquote>Dependencies</blockquote><p>First, ensure you have the necessary gems installed. Add the following lines to your Gemfile:</p><pre>gem &#39;rqrcode&#39;<br>gem &#39;vcard&#39;</pre><blockquote>Then run bundle install to install them.</blockquote><blockquote>The Code</blockquote><p>Here’s the complete implementation of the QrContactDetailsService class:</p><pre># QR code generator service.<br>class QrContactDetailsService<br>  def generate_qr_code(user_id, contact_details)<br>    vcard = build_vcard(contact_details)<br>    qr_code = RQRCode::QRCode.new(vcard.to_s)<br>    svg = qr_code.as_svg(<br>      offset: 0,<br>      color: &#39;000&#39;,<br>      shape_rendering: &#39;crispEdges&#39;,<br>      module_size: 6<br>    ).gsub(&#39;&quot;&#39;, &quot;&#39;&quot;)<br>    <br>    file = StringIO.new(svg)<br>    file.class.class_eval { attr_accessor :original_filename, :content_type }<br>    file.original_filename = &quot;qr_code_#{user_id}.svg&quot;<br>    file.content_type = &#39;image/svg+xml&#39;<br>    file<br>  rescue StandardError =&gt; e<br>    puts &quot;Error generating QR code: #{e.message}&quot;<br>    nil<br>  end<br><br>  private<br><br>  def build_vcard(contact_details)<br>    Vcard::Vcard::Maker.make2 do |maker|<br>      maker.add_name do |name|<br>        name.given = contact_details[:name]<br>      end<br>      maker.add_tel(contact_details[:phone])<br>      maker.add_email(contact_details[:email])<br>      maker.add_url(https://medium.com/contact_details[:facebook])<br>      maker.add_url(https://medium.com/contact_details[:skype])<br>      maker.add_url(https://medium.com/contact_details[:telegram])<br>      maker.add_url(https://medium.com/contact_details[:wechat])<br>    end<br>  end<br>end</pre><h3><strong><em>How It Works</em></strong></h3><blockquote><strong>Generating the QR Code</strong>:</blockquote><ul><li>The generate_qr_code method takes a user_id and a contact_details hash.</li><li>It creates a vCard using the build_vcard method.</li><li>The vCard string is then converted into a QR code.</li><li>The QR code is rendered as an SVG string, and a StringIO object is created to hold this SVG.</li></ul><blockquote><strong>Building the vCard</strong>:</blockquote><ul><li>The build_vcard method constructs a vCard using the provided contact details.</li><li>It includes fields like the user’s name, phone number, email, and various URLs (e.g., Facebook, Skype, Telegram, WeChat).</li></ul><blockquote><strong>Error Handling</strong>:</blockquote><ul><li>If any errors occur during the process, they are caught and an error message is printed.</li></ul><blockquote>Example Usage</blockquote><p>To use this service, you can create an instance of QrContactDetailsService and call the generate_qr_code method with the appropriate parameters:</p><pre>contact_details = {<br>  name: &#39;Mitesh Thakkar&#39;,<br>  phone: &#39;000000000&#39;,<br>  email: &#39;example@gmail.com&#39;,<br>  facebook: &#39;https://www.facebook.com/meet-thakkar&#39;,<br>  skype: &#39;skype:123456 (12345)&#39;,<br>  telegram: &#39;https://t.me/meet-thakkar&#39;,<br>  wechat: &#39;wechat:meet-thakkar&#39;<br>}<br><br>service = QrContactDetailsService.new<br>file = service.generate_qr_code(1, contact_details)<br><br>if file<br>  puts &quot;QR code generated: #{file.original_filename}&quot;<br>else<br>  puts &quot;Failed to generate QR code.&quot;<br>end</pre><blockquote>Conclusion</blockquote><p>The QrContactDetailsService class provides a simple yet powerful way to generate QR codes for contact details. By leveraging the RQRCode and Vcard gems, you can easily create and share vCard QR codes. This can be particularly useful for networking and business purposes.</p><p>Thank you for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=85d5c345afc7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Materialized views in Ruby on Rails]]></title>
            <link>https://medium.com/@mj.thakkar97/materialized-views-in-ruby-on-rails-4c7c269cf7cb?source=rss-f4bac123431a------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c7c269cf7cb</guid>
            <dc:creator><![CDATA[Mitesh Thakkar]]></dc:creator>
            <pubDate>Mon, 03 Jun 2024 04:43:28 GMT</pubDate>
            <atom:updated>2024-06-03T04:43:28.779Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*fpDZbdQJwvS6txYM8m0LDg.png" /></figure><p><a href="https://github.com/scenic-views/scenic">https://github.com/scenic-views/scenic</a> This will be helpful for the Materialized view for the database view.</p><p>PostgreSQL provides the view for the database query used for performance enhancement, which helps build an application with a big dataset.</p><p>This could help us in querying the data in a large amount of number</p><p>There are two types of view</p><ul><li>Standard view</li><li>Materialized view</li></ul><p>The standard view for the database is used for putting the queries in the view.sql file</p><p>example:</p><pre>select count(*), tshirt<br>from products<br>group by size, color</pre><pre># frozen_string_literal: true<br><br>class SearchProduct &lt; ApplicationRecord<br>  def self.refresh<br>    Scenic.database.refresh_materialized_view(table_name, concurrently: true, cascade: true)<br>  end<br>end</pre><p>The scenic gem helps create the database with migration and view files in our database with the multiple features, it provides, creating the same migration file for the version will create a new file with the version defined in the file name</p><p>That means it will not change the query inside the file. But will load a new set of queries in that particular file.</p><p>Scenic Gem also provides a refresh feature; it will refresh the cached query.</p><p><strong>Original Definition</strong>:</p><p><em>Simply speaking, the view query results are stored in the database — just like any other table. The only difference is that we can not update the view directly but can be refreshed using records from its source tables.</em></p><p><em>This way, instead of executing expensive queries, we can use data organized more simply in a materialized view.</em></p><p><strong>PostgreSQL Documentation explanation:</strong></p><p>Materialized views in PostgreSQL use the rule system like views do, but persist the results in a table-like form. The main differences between:</p><pre>CREATE MATERIALIZED VIEW mymatview AS SELECT * FROM mytab;</pre><p>and:</p><pre>CREATE TABLE mymatview AS SELECT * FROM mytab;</pre><p>are that the materialized view cannot subsequently be directly updated and that the query used to create the materialized view is stored in exactly the same way that a view’s query is stored, so that fresh data can be generated for the materialized view with:</p><pre>REFRESH MATERIALIZED VIEW mymatview;</pre><p>The information about a materialized view in the PostgreSQL system catalogs is the same as for a table or view. So for the parser, a materialized view is a relation, just like a table or a view. When a materialized view is referenced in a query, the data is returned directly from the materialized view, like a table; the rule is only used for populating the materialized view.</p><p><strong>Links to refer to:</strong></p><ul><li><a href="https://github.com/scenic-views/scenic">https://github.com/scenic-views/scenic</a></li><li><a href="https://www.postgresql.org/docs/current/rules-materializedviews.html">https://www.postgresql.org/docs/current/rules-materializedviews.html</a></li><li><a href="https://pganalyze.com/blog/materialized-views-ruby-rails">https://pganalyze.com/blog/materialized-views-ruby-rails</a></li><li><a href="https://medium.com/swlh/materialized-views-and-sidekiq-jobs-with-rails-f83b1e950f20">https://medium.com/swlh/materialized-views-and-sidekiq-jobs-with-rails-f83b1e950f20</a></li><li><a href="https://levelup.gitconnected.com/postgresql-views-with-ruby-on-rails-78260cd6f021">https://levelup.gitconnected.com/postgresql-views-with-ruby-on-rails-78260cd6f021</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c7c269cf7cb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to fetch file data from live links and IP addresses? (Ruby on Rails)]]></title>
            <link>https://medium.com/@mj.thakkar97/how-to-fetch-file-data-from-live-links-and-ip-addresses-ruby-on-rails-516190024300?source=rss-f4bac123431a------2</link>
            <guid isPermaLink="false">https://medium.com/p/516190024300</guid>
            <dc:creator><![CDATA[Mitesh Thakkar]]></dc:creator>
            <pubDate>Sat, 01 Jun 2024 09:29:24 GMT</pubDate>
            <atom:updated>2024-06-02T12:33:16.657Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*XkuO-tjAt0GVEHQI.jpeg" /></figure><p>If the link has an HTML page then what to do?</p><p>Using net/HTTP how to fetch files from an HTML Page, Here’s the example</p><p>We were doing this in an interesting project where there was requirement for fetching data from different data sources.</p><p>The data sources were IP, FTP, API, and Live Link.</p><p>Prerequisites:</p><pre>require net/http<br>require uri</pre><p>An example of fetching the file from an IP address.</p><p>The initialize method! (constructor you know):</p><p>We have grabbed the data source from a data source detail model and it is associated with the contacts model. Data contains URI or IP address.</p><pre>def initialize(vendor_id)<br>   @vendor = Contact.find_by(id: vendor_id)<br>   @data_sources =  @vendor.data_source_details.active<br> end</pre><p>Method where we call all the data sources so that we can manage all the data sources! Awesome right? 😎</p><pre>def call<br>  data_sources.each do |data_source|<br>    puts &quot;Starting Data Source Connection \n&quot;<br>    connect_api(data_source) if data_source.api?<br>    connect_ip(data_source) if data_source.ip?<br>    connect_ftp(data_source) if data_source.ftp?<br>    connect_live_link(data_source) if data_source.live_link?<br>  end<br>end</pre><p>You can find the code for net/http in the ruby net/http doc.</p><pre>def connect_ip(data_source)<br>  uri = data_source.config_details[&#39;ip_address&#39;]<br>  a = URI.parse(uri)<br>  r = Net::HTTP.get_response a<br>  res = r.body<br>  convert_ip_file(uri, res)<br>  data_source_process<br>end</pre><p><strong>Here comes the savior NOKOGIRI: 💂</strong></p><p>Want to grab a file from an HTML page? you must do web scraping right? 🤔</p><pre>def convert_ip_file(uri, res)<br>  doc = Nokogiri::HTML(res)<br>  files = doc.xpath(&#39;//a&#39;).map { |link| link[&#39;href&#39;] }<br>  files.each do |link|<br>    if File.extname(link).eql?(&#39;.csv&#39;)<br>      csv_file_path = uri + link<br>      uri1 = URI.parse(csv_file_path)<br>      response = Net::HTTP.get_response uri1<br>      File.write(&quot;@vendor.id&quot;&gt;public/#{@vendor.id}_fetched_data.csv&quot;, response.body)<br>    elsif File.extname(link).eql?(&#39;.xlsx&#39;)<br>      xlsx_file_path = uri + link<br>      uri2 = URI.parse(xlsx_file_path)<br>      response = Net::HTTP.get_response uri2<br>      File.binwrite(&quot;@vendor.id&quot;&gt;public/#{@vendor.id}_fetched_data.xlsx&quot;, response.body)<br>    end<br>  end<br>end</pre><p>The convert_ip_file method takes the argument from the above method.</p><p>arguments uri and res.</p><pre>Doc = Nokogiri::HTML(res) will generate below type code!<br>#(Document:0x483f0 {<br>name = &quot;document&quot;,<br>children = [<br>#(DTD:0x48404 { name = &quot;html&quot; }),<br>#(Element:0x48418 {<br>name = &quot;html&quot;,<br>children = [<br>#(Element:0x4842c { name = &quot;head&quot;, children = [ #(Element:0x48440 { name = &quot;title&quot;, children = [ #(Text &quot;your IP address - /&quot;)] })] }),<br>#(Element:0x48454 {<br>name = &quot;body&quot;,<br>children = [<br>#(Element:0x48468 { name = &quot;h1&quot;, children = [ #(Text &quot;183.87.182.182 - /&quot;)] }),<br>#(Element:0x4847c { name = &quot;hr&quot; }),<br>#(Text &quot;\r\n\r\n&quot;),<br>#(Element:0x48490 {<br>name = &quot;pre&quot;,<br>children = [<br>#(Text &quot; 2/8/2023 3:42 PM 3605830 &quot;),<br>#(Element:0x484a4 { name = &quot;a&quot;, attributes = [ #(Attr:0x484b8 { name = &quot;href&quot;, value = &quot;/value.csv&quot; })], children = [ #(Text &quot;value.csv&quot;)] }),<br>#(Element:0x484cc { name = &quot;br&quot; }),<br>#(Text &quot; 2/8/2023 3:42 PM 3163363 &quot;),<br>#(Element:0x484e0 {<br>name = &quot;a&quot;,<br>attributes = [ #(Attr:0x484f4 { name = &quot;href&quot;, value = &quot;/value.xlsx&quot; })],<br>children = [ #(Text &quot;value List!!! 02–08–2023.xlsx&quot;)]<br>}),<br>#(Element:0x48508 { name = &quot;br&quot; }),<br>#(Text &quot; 3/11/2022 12:20 PM 168 &quot;),<br>#(Element:0x4851c { name = &quot;a&quot;, attributes = [ #(Attr:0x48530 { name = &quot;href&quot;, value = &quot;/web.config&quot; })], children = [ #(Text &quot;web.config&quot;)] }),<br>#(Element:0x48544 { name = &quot;br&quot; })]<br>}),<br>#(Element:0x48558 { name = &quot;hr&quot; })]<br>})]<br>})]<br>})<br>Then we will grab the href tag with the below code.<br>files = doc.xpath(&#39;//a&#39;).map { |link| link[&#39;href&#39;] }</pre><p>We will grab the href tag with the below code.</p><pre>files = doc.xpath(&#39;//a&#39;).map { |link| link[&#39;href&#39;] }</pre><p>Then we will loop over the files and grab all the files with specific extensions If needed! 🧐</p><pre>files.each do |link|<br>  if File.extname(link).eql?(&#39;.csv&#39;)<br>    csv_file_path = uri + link<br>    uri1 = URI.parse(csv_file_path)<br>    response = Net::HTTP.get_response uri1<br>    File.write(&quot;@vendor.id&quot;&gt;public/#{@vendor.id}_fetched_data.csv&quot;, response.body)<br>  elsif File.extname(link).eql?(&#39;.xlsx&#39;)<br>    xlsx_file_path = uri + link<br>    uri2 = URI.parse(xlsx_file_path)<br>    response = Net::HTTP.get_response uri2<br>    File.binwrite(&quot;@vendor.id&quot;&gt;public/#{@vendor.id}_fetched_data.xlsx&quot;, response.body)<br>  end<br>end</pre><p>In that:</p><pre>File.binwrite(&quot;@vendor.id&quot;&gt;public/#{@vendor.id}_fetched_data.xlsx&quot;, response.body)</pre><p>This code will be used for writing all the data in the file. And that’s it, get all your content in your files.</p><p>Please Like Share Subscribe. 😁 just kidding</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*r6luvaoX-6L19uI8PgwGkQ.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=516190024300" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>