<?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 Dharmik Salakiya on Medium]]></title>
        <description><![CDATA[Stories by Dharmik Salakiya on Medium]]></description>
        <link>https://medium.com/@dharmik.salakiya_45762?source=rss-3cf74a36d958------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*xFRRARTrhnTJII8X</url>
            <title>Stories by Dharmik Salakiya on Medium</title>
            <link>https://medium.com/@dharmik.salakiya_45762?source=rss-3cf74a36d958------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 14:25:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dharmik.salakiya_45762/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[Implementing FTP in Rails: Automate File Uploads, Downloads, and Management]]></title>
            <link>https://medium.com/@dharmik.salakiya_45762/implementing-ftp-in-rails-automate-file-uploads-downloads-and-management-58d91a4b4e8d?source=rss-3cf74a36d958------2</link>
            <guid isPermaLink="false">https://medium.com/p/58d91a4b4e8d</guid>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[ftp-server]]></category>
            <category><![CDATA[ftp-client]]></category>
            <category><![CDATA[ruby-on-rails-development]]></category>
            <dc:creator><![CDATA[Dharmik Salakiya]]></dc:creator>
            <pubDate>Fri, 31 Oct 2025 10:32:23 GMT</pubDate>
            <atom:updated>2025-10-31T10:32:23.078Z</atom:updated>
            <content:encoded><![CDATA[<p>In today’s fast-paced development ecosystem, efficient data transfer between your local system and remote server is critical. Whether it’s moving reports, backups, or user uploads, <strong>File Transfer Protocol (FTP)</strong> remains one of the most reliable ways to manage such operations.</p><p>Ruby makes this even easier with its built-in <strong>net/ftp</strong> library, allowing Rails developers to seamlessly connect to FTP servers, upload or download files, and automate file management.</p><p>In this guide, we’ll cover:</p><ul><li>Why FTP integration is still important</li><li>How to implement FTP in your Ruby on Rails application</li><li>Common FTP methods and their practical usage</li><li>Benefits and real-world outcomes</li></ul><h3>🌐 What Is FTP and Why Use It in Rails?</h3><p><strong>FTP (File Transfer Protocol)</strong> is used to transfer files between local and remote systems. In Rails applications, integrating FTP can simplify processes such as:</p><ul><li>Automated data uploads or backups</li><li>File synchronization between environments</li><li>Integration with legacy or third-party systems using FTP</li><li>Batch processing or scheduled transfers via background jobs</li></ul><p>In short, <strong>FTP integration in Rails</strong> helps automate workflows and maintain consistency across environments.</p><h3>⚙️ Setting Up FTP in Ruby on Rails</h3><p>Ruby provides a native way to handle FTP through the net/ftp library.<br> Simply include it at the top of your Ruby file:</p><pre>require &#39;net/ftp&#39;</pre><p>This enables FTP connectivity and file operations directly within your Rails app.</p><h3>🧰 Commonly Used FTP Methods in Ruby</h3><p>Here are the most useful methods provided by the Net::FTP class with real examples you can use in your Rails application.</p><h3>1. ::open</h3><p>Establishes a connection to the FTP server and closes it automatically when the block ends.</p><pre>Net::FTP.open(SFTP_CONFIGURATION_URL, <br>              username: SFTP_CONFIGURATION_USERNAME, <br>              password: SFTP_CONFIGURATION_PASSWORD) do |ftp|<br>  # your FTP operations<br>end</pre><h3>2. getbinaryfile(remote_file, local_file, blocksize = DEFAULT_BLOCKSIZE)</h3><p>Downloads files from the remote server in <strong>binary mode</strong>.</p><pre>Net::FTP.open(SFTP_CONFIGURATION_URL, <br>              username: SFTP_CONFIGURATION_USERNAME, <br>              password: SFTP_CONFIGURATION_PASSWORD) do |ftp|<br>  ftp.getbinaryfile(&quot;/uploads/tmp_data/inventory.xls&quot;,<br>                    &quot;/home/er/projects/inventory.xls&quot;,<br>                    blocksize = DEFAULT_BLOCKSIZE)<br>end</pre><h3>3. gettextfile(remote_file, local_file)</h3><p>Downloads files in <strong>ASCII (text)</strong> mode and stores them locally.</p><pre>Net::FTP.open(SFTP_CONFIGURATION_URL, <br>              username: SFTP_CONFIGURATION_USERNAME, <br>              password: SFTP_CONFIGURATION_PASSWORD) do |ftp|<br>  ftp.gettextfile(&quot;/uploads/tmp_data/inventory.txt&quot;,<br>                  &quot;/home/er/projects/inventory.txt&quot;)<br>end</pre><h3>4. putbinaryfile(local_file, remote_file)</h3><p>Uploads files to the remote server in <strong>binary mode</strong>.</p><pre>Net::FTP.open(SFTP_CONFIGURATION_URL, <br>              username: SFTP_CONFIGURATION_USERNAME, <br>              password: SFTP_CONFIGURATION_PASSWORD) do |ftp|<br>  ftp.putbinaryfile(&quot;/home/er/projects/inventory.xls&quot;,<br>                    &quot;/uploads/tmp_data/inventory.xls&quot;)<br>end</pre><h3>5. puttextfile(local_file, remote_file)</h3><p>Uploads files in <strong>ASCII (text)</strong> mode.</p><pre>Net::FTP.open(SFTP_CONFIGURATION_URL, <br>              username: SFTP_CONFIGURATION_USERNAME, <br>              password: SFTP_CONFIGURATION_PASSWORD) do |ftp|<br>  ftp.puttextfile(&quot;/home/er/projects/inventory.txt&quot;,<br>                  &quot;/uploads/tmp_data/inventory.txt&quot;)<br>end</pre><h3>6. chdir(directory)</h3><p>Changes the remote directory and lists its contents.</p><pre>Net::FTP.open(SFTP_CONFIGURATION_URL, <br>              username: SFTP_CONFIGURATION_USERNAME, <br>              password: SFTP_CONFIGURATION_PASSWORD) do |ftp|<br>  ftp.chdir(&quot;uploads/&quot;)<br>  files = ftp.list<br>end</pre><h3>7. rename(old_name, new_name)</h3><p>Renames a file on the remote server.</p><pre>Net::FTP.open(SFTP_CONFIGURATION_URL, <br>              username: SFTP_CONFIGURATION_USERNAME, <br>              password: SFTP_CONFIGURATION_PASSWORD) do |ftp|<br>  ftp.rename(&quot;stock_data.txt&quot;, &quot;all_stock_details.txt&quot;)<br>end</pre><h3>8. delete(filename)</h3><p>Deletes a file from the remote server.</p><pre>def delete_file<br>  filename = &quot;/uploads/tmp_data/inventory.xls&quot;<br>  response = sendcmd(&quot;DELE #{filename}&quot;)<br>end</pre><h3>💡 Benefits of FTP Integration in Rails</h3><p>Implementing FTP in your Ruby on Rails application can bring multiple advantages:</p><ul><li>✅ <strong>Simplified File Management:</strong> Easily move or sync large files.</li><li>🔁 <strong>Automation Ready:</strong> Integrate with background jobs for scheduled transfers.</li><li>🔒 <strong>Secure Access:</strong> Supports authentication and directory restrictions.</li><li>⚡ <strong>High Reliability:</strong> Proven protocol widely supported across systems.</li><li>🌍 <strong>Cross-Platform:</strong> Works seamlessly between different servers and OS.</li></ul><h3>🎯 Key Outcomes</h3><p>By leveraging FTP in your Rails application, you can:</p><ul><li>Automate repetitive file-based workflows.</li><li>Reduce manual uploads and downloads.</li><li>Improve synchronization between production, staging, and backup environments.</li><li>Integrate effortlessly with legacy enterprise systems.</li></ul><p>In short, you’ll save time, minimize errors, and improve reliability.</p><h3>🏁 Conclusion</h3><p>While newer technologies like SFTP and APIs dominate modern architectures, <strong>FTP still has its place</strong> — especially when working with older systems or simple file-based exchanges.<br> With Ruby’s net/ftp library, Rails developers can easily integrate FTP operations, automate them, and ensure smooth data management across environments.</p><blockquote><em>If you’re building or upgrading a Rails application that needs automated file handling — FTP integration is a reliable, straightforward solution to consider.</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=58d91a4b4e8d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Migrating from Rails 6 to 8: How esbuild Helped Us Fix the JavaScript Bottleneck Rails Upgrade That…]]></title>
            <link>https://medium.com/@dharmik.salakiya_45762/migrating-from-rails-6-to-8-how-esbuild-helped-us-fix-the-javascript-bottleneck-rails-upgrade-that-25f6fc9bf1ff?source=rss-3cf74a36d958------2</link>
            <guid isPermaLink="false">https://medium.com/p/25f6fc9bf1ff</guid>
            <category><![CDATA[esbuild]]></category>
            <category><![CDATA[javascript-bundling]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[rails-7]]></category>
            <category><![CDATA[rails-upgrade]]></category>
            <dc:creator><![CDATA[Dharmik Salakiya]]></dc:creator>
            <pubDate>Tue, 30 Sep 2025 08:55:30 GMT</pubDate>
            <atom:updated>2025-09-30T08:55:30.720Z</atom:updated>
            <content:encoded><![CDATA[<h3>Migrating from Rails 6 to 8: How esbuild Helped Us Fix the JavaScript Bottleneck Rails Upgrade That Sparked a Bigger Change</h3><p>When we started migrating our monolith from <strong>Rails 6 to Rails 8</strong>, we expected the usual suspects:</p><ul><li>Deprecations</li><li>Gem updates</li><li>Syntax tweaks</li><li>Config changes</li></ul><p>But what we didn’t expect was that the biggest win would come from <strong>rethinking how we build JavaScript</strong>.</p><p>What began as a routine framework upgrade turned into an opportunity to fix our sluggish JS pipeline — and <strong>esbuild</strong> turned out to be the hero.</p><h3>The Bottleneck: JavaScript Slowing Everything Down</h3><p>By the time we were on Rails 6, our JavaScript build system was showing its age:</p><ul><li>🔥 Hot reloads weren’t hot anymore</li><li>⏳ Local changes took forever to reflect</li><li>🏗️ CI/CD pipelines crawled under bloated build scripts</li></ul><p>We were still tied to the legacy asset pipeline and Webpacker. Even with tweaks and caching, builds were taking <strong>minutes instead of seconds</strong>.</p><p>During the Rails 8 upgrade, we had a choice:<br> 👉 Keep patching Webpacker, or<br> 👉 Rethink our pipeline entirely.</p><p>We chose the second option.</p><h3>The Breakthrough: Discovering esbuild</h3><p>Rails 8 introduced <strong>jsbundling-rails</strong>, with esbuild as the preferred bundler.</p><p>At first, we tried it just to evaluate performance. But once we saw the results, there was <strong>no turning back</strong>.</p><h3>The Migration: From Webpacker to esbuild</h3><p>Here’s how we transitioned:</p><pre>bundle remove webpacker<br>bundle add jsbundling-rails<br>rails javascript:install:esbuild</pre><p>We restructured our asset pipeline, rewired build scripts, and ditched legacy Webpack configs for a <strong>clean, blazing-fast setup</strong>.</p><h3>Why esbuild?</h3><p>Without esbuild, we were running into several issues:</p><ul><li>⏳ <strong>Slow builds</strong> — Webpacker and the legacy pipeline were taking 2–3 minutes for small changes, killing developer momentum.</li><li>🔄 <strong>Hot reload delays</strong> — Instant feedback during development was almost impossible.</li><li>⚠️ <strong>Complex configs</strong> — Webpack required multiple loaders, custom rules, and environment-specific tweaks.</li><li>🏗️ <strong>Bloated CI/CD</strong> — CI/CD pipelines had to wait long minutes to build JS, delaying deployments.</li></ul><p>esbuild solved these problems by:</p><ul><li>⚡ Extremely <strong>fast builds</strong> even on large JS codebases.</li><li>🔁 Truly <strong>instant hot reloads</strong>.</li><li>🛠 <strong>Minimal configuration</strong> — no need for dozens of Webpack loaders or custom scripts.</li><li>🌐 Native <strong>ESM support</strong>, making modern JavaScript simpler to integrate.</li><li>📦 Lightweight — fewer dependencies, less maintenance overhead.</li></ul><h3>Our Detailed Minimal esbuild Setup</h3><p>We kept things lean with a simple package.json configuration:</p><pre>{<br>  &quot;scripts&quot;: {<br>    &quot;build&quot;: &quot;esbuild app/javascript/application.js --bundle --sourcemap --format=esm --outdir=app/assets/builds&quot;,<br>    &quot;watch&quot;: &quot;esbuild app/javascript/application.js --bundle --sourcemap --format=esm --outdir=app/assets/builds --watch&quot;,<br>    &quot;copy:assets&quot;: &quot;cp -r app/assets/images/* public/images/&quot;<br>  }<br>}</pre><p><strong>Notes and tips:</strong></p><ul><li>--bundle combines all JS files into a single output, avoiding multiple requests.</li><li>--sourcemap Keeps debugging easy in browsers.</li><li>--format=esm allows modern ES modules, making code cleaner.</li><li>--watch enables automatic rebuilds when files change.</li><li>copy:assets ensures images and static files are available without a complex loader.</li></ul><h3>Steps We Took to Smooth the Transition</h3><ol><li><strong>Remove legacy Webpacker</strong> — eliminated outdated Webpack configs.</li><li><strong>Install jsbundling-rails</strong> — Rails 8 integrates esbuild natively.</li><li><strong>Restructure JS folders</strong> — moved JS entry points to app/javascript/.</li><li><strong>Refactor imports</strong> — switched from Webpacker helpers to direct JS imports.</li><li><strong>Add watch scripts for development</strong> — hot reloads became truly instant.</li><li><strong>Test thoroughly</strong> — ensured all JS functionality, including third-party libraries, worked seamlessly.</li></ol><p><strong>Result:</strong> Developers gained <strong>speed, simplicity, and joy</strong>, while builds became predictable, fast, and maintainable.</p><h3>The Results: Speed, Simplicity, and Developer Joy</h3><p>After switching, the improvements were immediate:</p><ul><li>⚡ Build times dropped from 2–3 minutes ➝ under 5 seconds</li><li>🔄 Hot reloads became truly instant</li><li>🚀 CI/CD pipelines sped up, saving 10–15 minutes per deploy</li><li>❤️ Developers loved the reduced config and dependencies</li></ul><p><strong>Key takeaway:</strong> Performance is developer experience. By fixing the bottleneck, we gave <strong>joy and velocity</strong> back to our team.</p><h3>Thinking of Upgrading? Here’s Our Advice</h3><p>If you’re planning a Rails 8 upgrade, here’s what we learned:</p><ul><li>🔧 Use it as a chance to rethink frontend tooling</li><li>🗑️ Say goodbye to Webpacker — it’s time</li><li>⚡ Don’t fear esbuild: it’s fast, lightweight, and Rails-ready</li><li>👯 Pair up during tricky parts — migration goes smoother together</li></ul><h3>Summary</h3><p>What started as a routine Rails 6 → Rails 8 upgrade quickly turned into a full-blown <strong>performance overhaul</strong>. The biggest win wasn’t just deprecations or gem updates — it was <strong>fixing our sluggish JavaScript pipeline</strong>.</p><p>By ditching Webpacker and embracing esbuild through jsbundling-rails, we cut build times from <strong>minutes to seconds</strong>, made hot reloads instantaneous, and simplified our asset pipeline. The enhanced JS bundling setup, with watch scripts, ESM support, and minimal configuration, proved that <strong>small, smart changes can make a huge impact</strong> on developer productivity.</p><h3>Conclusion: A Little Cleanup Goes a Long Way</h3><p>Upgrading Rails isn’t just about keeping up with the framework — it’s about taking a hard look at the friction slowing your team down. Sometimes the bottlenecks aren’t in Ruby at all, but in your <strong>JavaScript build</strong>.</p><p>By rethinking the frontend pipeline, adding watch scripts, and embracing esbuild, we didn’t just speed up builds — we boosted developer joy, reduced stress, and gave our CI/CD pipelines a caffeine shot.</p><p>So, if you’re staring down a Rails upgrade and dreading the mess: <strong>embrace the chaos, rethink the obvious, and don’t be afraid to Marie Kondo your assets</strong>. Because sometimes, tidying up your JavaScript is exactly what your team needs to spark the <strong>bigger change</strong>.</p><p>LinkedIn — <a href="https://www.linkedin.com/in/dharmik-salakiya-771854159?lipi=urn%3Ali%3Apage%3Ad_flagship3_profile_view_base_contact_details%3BRC%2BwNfqIQsypLJ0XdiG7%2Fw%3D%3D">https://www.linkedin.com/in/dharmik-salakiya-771854159?</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=25f6fc9bf1ff" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>