<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Railsmine</title>
    <description>KAK Labs blog focused on Ruby programming language tutorials, tips, and best practices
</description>
    <link>https://www.railsmine.net/</link>
    <atom:link href="https://www.railsmine.net/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Fri, 16 Jan 2026 23:36:36 +0700</pubDate>
    <lastBuildDate>Fri, 16 Jan 2026 23:36:36 +0700</lastBuildDate>
    <generator>Jekyll v4.4.1</generator>
    
      <item>
        <title>How to Call C Code from Ruby Using FFI</title>
        <description>&lt;p&gt;In this tutorial, we’ll create a small C library that provides a function to add two integers, and then we’ll use FFI in Ruby to call that function.&lt;/p&gt;

&lt;h2 id=&quot;1-create-the-c-library&quot;&gt;1. Create the C Library&lt;/h2&gt;

&lt;p&gt;First, we’ll write a simple C library with a function to add two integers.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-c&quot; data-lang=&quot;c&quot;&gt;&lt;span class=&quot;c1&quot;&gt;// myadder.c&lt;/span&gt;

&lt;span class=&quot;cp&quot;&gt;#include&lt;/span&gt; &lt;span class=&quot;cpf&quot;&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;
&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// Function to add two integers&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;2-compile-the-c-library&quot;&gt;2. Compile the C Library&lt;/h2&gt;
&lt;p&gt;Compile this code into a shared library. On Unix-based systems (Linux, macOS), you can use the following command:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;gcc &lt;span class=&quot;nt&quot;&gt;-shared&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; libadder.so &lt;span class=&quot;nt&quot;&gt;-fPIC&lt;/span&gt; myadder.c&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;On Windows, you would use:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;gcc &lt;span class=&quot;nt&quot;&gt;-shared&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; adder.dll myadder.c&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;3-use-ffi-in-ruby&quot;&gt;3. Use FFI in Ruby&lt;/h2&gt;

&lt;p&gt;Now, we’ll write Ruby code to use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ffi&lt;/code&gt; gem to call the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;add&lt;/code&gt; function from our C library.
If you haven’t already installed the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ffi&lt;/code&gt; gem, you can do so using:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;gem &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;ffi&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;&lt;span class=&quot;c1&quot;&gt;# caller.rb&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;ffi&apos;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;module&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Adder&lt;/span&gt;
  &lt;span class=&quot;kp&quot;&gt;extend&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;FFI&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Library&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;# Load the shared library&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;ffi_lib&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;./libadder.so&apos;&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;# Use &apos;libadder.dll&apos; on Windows&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;# Attach the add function&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# Maps the `add` function from the C library to Ruby.&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# The arguments and return type are specified in the array (`[:int, :int]`&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# for two integers and `:int` for the return type).&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;attach_function&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:int&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# Use the add function&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Adder&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;The result of adding 3 and 7 is: &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;running-the-example&quot;&gt;Running the Example&lt;/h2&gt;

&lt;p&gt;Ensure that the compiled shared library (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;libadder.so&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;adder.dll&lt;/code&gt;) is in the same directory as your Ruby script or
in a directory included in your library path.&lt;/p&gt;

&lt;p&gt;Run your Ruby script:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;&lt;span class=&quot;n&quot;&gt;ruby&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;caller&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;rb&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;You should see the output:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-plain&quot; data-lang=&quot;plain&quot;&gt;The result of adding 3 and 7 is: 10&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;You can explore the code by visiting my &lt;a href=&quot;https://github.com/kuntoaji/ruby-playground/tree/main/c-binding-ffi&quot;&gt;GitHub repository&lt;/a&gt;.&lt;/p&gt;

</description>
        <pubDate>Sat, 14 Sep 2024 08:28:00 +0700</pubDate>
        <link>https://www.railsmine.net/2024/09/how-to-call-c-code-from-ruby-using-ffi.html</link>
        <guid isPermaLink="true">https://www.railsmine.net/2024/09/how-to-call-c-code-from-ruby-using-ffi.html</guid>
        
        <category>ruby</category>
        
        <category>c</category>
        
        <category>ffi</category>
        
        
        <category>tutorial</category>
        
      </item>
    
      <item>
        <title>Rails - New Shortcut for Not Null Columns in Migrations</title>
        <description>&lt;p&gt;Rails is introducing a handy new feature in its migration generator: a shortcut for creating not null columns. This enhancement, &lt;a href=&quot;https://github.com/rails/rails/pull/52327&quot;&gt;submitted
by David Heinemeier Hansson (DHH) himself&lt;/a&gt;, simplifies the process of defining required fields in your database schema.&lt;/p&gt;

&lt;h2 id=&quot;the-new-syntax&quot;&gt;The New Syntax&lt;/h2&gt;

&lt;p&gt;Previously, to create a not null column, you’d have to explicitly specify &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;null: false&lt;/code&gt; in your migration. Now, you can use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;!&lt;/code&gt; symbol as a shortcut.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-plain&quot; data-lang=&quot;plain&quot;&gt;bin/rails generate migration CreateUsers email_address:string!:uniq password_digest:string!&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This generates the following migration:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;CreateUsers&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;ActiveRecord&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Migration&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;8.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;change&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;create_table&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:users&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:email_address&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;null: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;false&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:password_digest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;null: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;false&lt;/span&gt;

      &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;timestamps&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;add_index&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:users&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:email_address&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;unique: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

</description>
        <pubDate>Tue, 23 Jul 2024 06:38:00 +0700</pubDate>
        <link>https://www.railsmine.net/2024/07/rails-new-shortcut-for-not-null-columns-in-migrations.html</link>
        <guid isPermaLink="true">https://www.railsmine.net/2024/07/rails-new-shortcut-for-not-null-columns-in-migrations.html</guid>
        
        <category>rails</category>
        
        <category>ruby</category>
        
        
        <category>rails</category>
        
      </item>
    
      <item>
        <title>How to Install Ruby 3.4 with YJIT Enabled</title>
        <description>&lt;p&gt;In this blog post, I will explain how to install Ruby with &lt;a href=&quot;https://github.com/ruby/ruby/blob/master/doc/yjit/yjit.md&quot;&gt;YJIT&lt;/a&gt; enabled and &lt;a href=&quot;https://github.com/postmodern/chruby&quot;&gt;chruby&lt;/a&gt;.
If you are looking for Ruby installation without YJIT, please visit &lt;a href=&quot;https://www.railsmine.net/2019/01/install-and-uninstall-ruby-chruby.html&quot;&gt;How To Install and Uninstall Ruby Using chruby&lt;/a&gt; post.&lt;/p&gt;

&lt;p&gt;YJIT is a lightweight, minimalistic Ruby JIT built inside CRuby.
it is a new just-in-time compiler for Ruby that was introduced in Ruby 3.0.&lt;/p&gt;

&lt;p&gt;YJIT promises faster performance for Ruby programs by compiling them at runtime.
It lazily compiles code using a Basic Block Versioning (BBV) architecture.
The target use case is that of servers running Ruby on Rails.&lt;/p&gt;

&lt;h2 id=&quot;requirements&quot;&gt;Requirements&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Ruby dependencies.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/postmodern/chruby&quot;&gt;chruby&lt;/a&gt; - I assume chruby is already installed, I’ll skip the installation process.&lt;/li&gt;
  &lt;li&gt;The &lt;a href=&quot;https://www.rust-lang.org&quot;&gt;Rust&lt;/a&gt; compiler rustc and Cargo (if you want to build in dev/debug mode)
    &lt;ul&gt;
      &lt;li&gt;The Rust version must be &amp;gt;= 1.58.0.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;ruby-dependencies&quot;&gt;Ruby Dependencies&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;Install the prerequisite dependencies for building the CRuby interpreter:&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;C compiler&lt;/li&gt;
    &lt;/ul&gt;

    &lt;p&gt;For RubyGems, you will also need:&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;OpenSSL 1.1.x or 3.0.x / LibreSSL&lt;/li&gt;
      &lt;li&gt;libyaml 0.1.7 or later&lt;/li&gt;
      &lt;li&gt;zlib&lt;/li&gt;
    &lt;/ul&gt;

    &lt;p&gt;If you want to build from the git repository, you will also need:&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;autoconf - 2.67 or later&lt;/li&gt;
      &lt;li&gt;bison - 3.0 or later&lt;/li&gt;
      &lt;li&gt;gperf - 3.1 or later
        &lt;ul&gt;
          &lt;li&gt;Usually unneeded; only if you edit some source files using gperf&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;ruby - 2.5 or later
        &lt;ul&gt;
          &lt;li&gt;We can upgrade this version to system ruby version of the latest Ubuntu LTS.&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Install optional, recommended dependencies:&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;readline/editline (libedit, to build readline)&lt;/li&gt;
      &lt;li&gt;libffi (to build fiddle)&lt;/li&gt;
      &lt;li&gt;gmp (if you with to accelerate Bignum operations)&lt;/li&gt;
      &lt;li&gt;libexecinfo (FreeBSD)&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://www.rust-lang.org&quot;&gt;rustc&lt;/a&gt; - 1.58.0 or later (if you wish to build &lt;a href=&quot;https://github.com/ruby/ruby/blob/master/doc/yjit/yjit.md&quot;&gt;YJIT&lt;/a&gt;)&lt;/li&gt;
    &lt;/ul&gt;

    &lt;p&gt;If you installed the libraries needed for extensions (openssl, readline, libyaml, zlib) into other than the OS default place,
 typically using Homebrew on macOS, add &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--with-EXTLIB-dir&lt;/code&gt; options to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CONFIGURE_ARGS&lt;/code&gt; environment variable.&lt;/p&gt;

    &lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; &lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;CONFIGURE_ARGS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;ext &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;openssl readline libyaml zlib&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do
   &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;CONFIGURE_ARGS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;CONFIGURE_ARGS&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; --with-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$ext&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-dir=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;brew &lt;span class=&quot;nt&quot;&gt;--prefix&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ext&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For Ubuntu Linux, just copy and paste command below to install the required dependencies:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt; build-essential bison zlib1g-dev libyaml-dev libssl-dev libreadline-dev libffi-dev&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;How to Install Rust:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;curl &lt;span class=&quot;nt&quot;&gt;--proto&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;=https&apos;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--tlsv1&lt;/span&gt;.2 &lt;span class=&quot;nt&quot;&gt;-sSf&lt;/span&gt; https://sh.rustup.rs | sh&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;mri-ruby-34-installation-with-yjit-enabled-for-chruby&quot;&gt;MRI Ruby 3.4 Installation with YJIT Enabled for chruby&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;wget https://cache.ruby-lang.org/pub/ruby/3.4/ruby-3.4.2.tar.gz
&lt;span class=&quot;nb&quot;&gt;tar&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-xvzf&lt;/span&gt; ruby-3.4.2.tar.gz
&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;ruby-3.4.2

&lt;span class=&quot;c&quot;&gt;# Generate the configure file&lt;/span&gt;
./autogen.sh

&lt;span class=&quot;c&quot;&gt;# don&apos;t forget to create /opt/rubies directory&lt;/span&gt;
./configure &lt;span class=&quot;nt&quot;&gt;--enable-yjit&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--prefix&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/opt/rubies/ruby-3.4.2 &lt;span class=&quot;nt&quot;&gt;--disable-install-doc&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# If your machine have a lot of RAM, you can&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# use `make -j install` to make installation faster&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# `make install` compiles with a single cpu core only.&lt;/span&gt;
make &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;You can test that YJIT works correctly by running:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;# Quick tests found in /bootstraptest&lt;/span&gt;
make btest

&lt;span class=&quot;c&quot;&gt;# Complete set of tests&lt;/span&gt;
make &lt;span class=&quot;nt&quot;&gt;-j&lt;/span&gt; test-all&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;If the installation is successful, upon reloading the shell, running &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;chruby&lt;/code&gt; will display &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ruby-3.4.2&lt;/code&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;chruby
   ruby-3.2.2
   ruby-3.3.1
   ruby-3.4.2&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Note that there is also an environment variable &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RUBY_YJIT_ENABLE&lt;/code&gt; which can be used to enable or disable YJIT. This can be useful
for some deployment scripts where specifying an extra command-line option to Ruby is not practical.&lt;/p&gt;

&lt;p&gt;You can verify that YJIT is enabled by checking that &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ruby -v --yjit&lt;/code&gt; includes the string &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;+YJIT&lt;/code&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;ruby 3.4.2 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;2025-02-15 revision d2930f8e7a&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; +YJIT +PRISM &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;x86_64-linux]&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

</description>
        <pubDate>Sun, 07 May 2023 21:31:00 +0700</pubDate>
        <link>https://www.railsmine.net/2023/05/how-to-install-ruby-yjit.html</link>
        <guid isPermaLink="true">https://www.railsmine.net/2023/05/how-to-install-ruby-yjit.html</guid>
        
        <category>ruby</category>
        
        
        <category>tutorial</category>
        
      </item>
    
      <item>
        <title>Ribsum - Lightweight and Simple Lorem Ipsum Text Generator</title>
        <description>&lt;p&gt;Hi! I’ve created &lt;a href=&quot;https://github.com/kuntoaji/ribsum&quot;&gt;Ribsum&lt;/a&gt; Ruby gem. &lt;a href=&quot;https://github.com/kuntoaji/ribsum&quot;&gt;Ribsum&lt;/a&gt; is a lightweight Ruby gem that allows you to easily generate lorem ipsum text.&lt;/p&gt;

&lt;p&gt;The reason is why create this gem is so many unmaintained Lorem Ipsum generator.
Beside that I want to create simpler Lorem Ipsum generator.&lt;/p&gt;

&lt;p&gt;Ribsum is a useful tool for anyone working on a design project or who needs placeholder text for a website or application.&lt;/p&gt;

&lt;p&gt;To use Ribsum, simply install the gem and require it in your Ruby code:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-plain&quot; data-lang=&quot;plain&quot;&gt;gem install ribsum&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Once you have Ribsum installed, you can use it to generate lorem ipsum text in a few different ways. You can call the Ribsum methods directly, like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;&lt;span class=&quot;c1&quot;&gt;# Paragraph&lt;/span&gt;
&lt;span class=&quot;no&quot;&gt;Ribsum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;paragraphs&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# default 1 paragraph&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# =&amp;gt; Lorem ipsum dolor sit amet...laborum&lt;/span&gt;

&lt;span class=&quot;no&quot;&gt;Ribsum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;paragraphs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# =&amp;gt; Lorem ipsum dolor sit amet...laborum.&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# =&amp;gt; Lorem ipsum dolor sit amet...laborum.&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# Sentences&lt;/span&gt;
&lt;span class=&quot;no&quot;&gt;Ribsum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;sentences&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# default 1 sentence&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# =&amp;gt; Lorem ipsum dolor sit amet...aliqua&lt;/span&gt;

&lt;span class=&quot;no&quot;&gt;Ribsum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;sentences&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# =&amp;gt; Lorem ipsum dolor sit amet...consequat&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# Words&lt;/span&gt;
&lt;span class=&quot;no&quot;&gt;Ribsum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;words&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# default 1 word&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# =&amp;gt; Lorem&lt;/span&gt;

&lt;span class=&quot;no&quot;&gt;Ribsum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;words&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# =&amp;gt; Lorem ipsum&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# Characters&lt;/span&gt;
&lt;span class=&quot;no&quot;&gt;Ribsum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;chars&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# default 1 character&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# =&amp;gt; L&lt;/span&gt;

&lt;span class=&quot;no&quot;&gt;Ribsum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;chars&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# =&amp;gt; Lo&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Alternatively, you can include Ribsum in your own class, like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MyClass&lt;/span&gt;
  &lt;span class=&quot;kp&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Ribsum&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;my_class&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;MyClass&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;my_class&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;paragraphs&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# =&amp;gt; Lorem ipsum dolor sit amet...laborum&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;my_class&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;sentences&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# =&amp;gt; Lorem ipsum dolor sit amet...aliqua&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;my_class&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;words&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# =&amp;gt; Lorem&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;my_class&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;chars&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# =&amp;gt; L&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Ribsum is a simple and easy-to-use gem that can save you time and effort when working on design projects or creating placeholder text. It is a valuable tool for any Ruby developer.&lt;/p&gt;

</description>
        <pubDate>Mon, 05 Dec 2022 23:36:00 +0700</pubDate>
        <link>https://www.railsmine.net/2022/12/ribsum-lorem-ipsum-text-generator.html</link>
        <guid isPermaLink="true">https://www.railsmine.net/2022/12/ribsum-lorem-ipsum-text-generator.html</guid>
        
        <category>ruby</category>
        
        
        <category>tutorial</category>
        
      </item>
    
      <item>
        <title>How Add Elements an Array and Automatically Remove Duplicates in Ruby</title>
        <description>&lt;p&gt;Operator &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;|=&lt;/code&gt; is bitwise OR assignment in Ruby.
While working with Array, using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;|=&lt;/code&gt; operator will automatically add elements and remove duplicates.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# =&amp;gt; [1,2,2,3,3]&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# =&amp;gt; [3,4,5]&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# a |= b is shorthand for a = a | b&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# =&amp;gt; [1,2,3,4,5]&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# Array with element of string can use |= operator too&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;aa&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;bb&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# =&amp;gt; [&apos;aa&apos;, &apos;bb&apos;]&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;y&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;b&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;cc&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# =&amp;gt; [&apos;b&apos;, &apos;cc&apos;]&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# =&amp;gt; [&apos;aa&apos;, &apos;bb&apos;, &apos;b&apos;, &apos;cc&apos;]&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

</description>
        <pubDate>Sat, 03 Sep 2022 06:43:00 +0700</pubDate>
        <link>https://www.railsmine.net/2022/09/add-elements-array-automatically-remove-duplicates-ruby.html</link>
        <guid isPermaLink="true">https://www.railsmine.net/2022/09/add-elements-array-automatically-remove-duplicates-ruby.html</guid>
        
        <category>ruby</category>
        
        
        <category>ruby</category>
        
      </item>
    
      <item>
        <title>Access Nested Hash Value with Dig Method in Ruby</title>
        <description>&lt;p&gt;When you need to access value from nested Hash, it’s better to use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dig&lt;/code&gt; method.
Without &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dig&lt;/code&gt; you have to do nil checking to prevent error.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;&lt;span class=&quot;n&quot;&gt;names&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;domains: &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;blogs: &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;kaklabs.com&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;railsmine.net&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;tools: &lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;tools.kaklabs.com&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}}&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# =&amp;gt; {:domains=&amp;gt;{:blogs=&amp;gt;[&quot;kaklabs.com&quot;, &quot;railsmine.net&quot;], :tools=&amp;gt;&quot;tools.kaklabs.com&quot;}}&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;names&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:domains&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:tools&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# =&amp;gt; &quot;tools.kaklabs.com&quot;&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;ames&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:domains&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:tools&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# =&amp;gt; &quot;tools.kaklabs.com&quot;&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;names&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:random&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:tools&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# in `&amp;lt;main&amp;gt;&apos;: undefined method `[]&apos; for nil:NilClass (NoMethodError)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# from /home/example/.rvm/rubies/ruby-3.1.1/lib/ruby/gems/3.1.0/gems/irb-1.4.1/exe/irb:11:in `&amp;lt;top (required)&amp;gt;&apos;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# from /home/example/.rvm/rubies/ruby-3.1.1/bin/irb:25:in `load&apos;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# from /home/example/.rvm/rubies/ruby-3.1.1/bin/irb:25:in `&amp;lt;main&amp;gt;&apos;&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;names&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:random&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:tools&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# =&amp;gt; nil&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

</description>
        <pubDate>Wed, 24 Aug 2022 21:58:00 +0700</pubDate>
        <link>https://www.railsmine.net/2022/08/access-nested-hash-value-dig-method-ruby.html</link>
        <guid isPermaLink="true">https://www.railsmine.net/2022/08/access-nested-hash-value-dig-method-ruby.html</guid>
        
        <category>ruby</category>
        
        
        <category>ruby</category>
        
      </item>
    
      <item>
        <title>How to Solve &quot;Could not find MIME type database&quot; Error on M1 MacBook</title>
        <description>&lt;p&gt;When installing ruby gems for a new project I get the following error on my M1 MacBook.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-plaintext&quot; data-lang=&quot;plaintext&quot;&gt;Could not find MIME type database in the following
locations: [&quot;/usr/local/share/mime/packages/freedesktop.org.xml&quot;,
&quot;/opt/homebrew/share/mime/packages/freedesktop.org.xml&quot;,
&quot;/opt/local/share/mime/packages/freedesktop.org.xml&quot;, &quot;/usr/share/mime/packages/freedesktop.org.xml&quot;]&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;After some Googling, there are 2 solutions to solve this error.&lt;/p&gt;

&lt;h2 id=&quot;manually-copy--paste-file-freedesktoporgxml&quot;&gt;Manually Copy &amp;amp; Paste File freedesktop.org.xml&lt;/h2&gt;

&lt;p&gt;First, create a file named &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;freedesktop.org.xml&lt;/code&gt;, copy the file content found from &lt;a href=&quot;https://cgit.freedesktop.org/xdg/shared-mime-info/tree/freedesktop.org.xml.in?h=Release-1-9&quot;&gt;Freedesktop&lt;/a&gt; and save it to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;freedesktop.org.xml&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Second, set the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;FREEDESKTOP_MIME_TYPES_PATH&lt;/code&gt; environment variable.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;FREEDESKTOP_MIME_TYPES_PATH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/path/to/freedesktop.org.xml&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;install-dependency-via-homebrew&quot;&gt;Install Dependency via Homebrew&lt;/h2&gt;

&lt;p&gt;Alternatively, if Homebrew is installed on your M1 Macbook, just run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;brew install shared-mime-info&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://stackoverflow.com/questions/69248078/mimemagic-install-error-could-not-find-mime-type-database-in-the-following-loc&quot;&gt;mimemagic install error: “Could not find MIME type database in the following locations…” on Windows&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/rails/rails/issues/41757#issuecomment-806938727&quot;&gt;New mimemagic version licensed under MIT&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
        <pubDate>Thu, 13 Jan 2022 22:28:00 +0700</pubDate>
        <link>https://www.railsmine.net/2022/01/solve-could-not-find-mime-type-database-error.html</link>
        <guid isPermaLink="true">https://www.railsmine.net/2022/01/solve-could-not-find-mime-type-database-error.html</guid>
        
        <category>ruby</category>
        
        <category>gems</category>
        
        
        <category>ruby</category>
        
      </item>
    
      <item>
        <title>How To Install Old Version Ruby 2.7.1 and 2.7.2 on M1 Mac</title>
        <description>&lt;p&gt;Installing old version Ruby version 2.7.1 and 2.7.2 always raises an error on my Apple M1 Macbook.
These are my steps on how to install Ruby 2.7.1 and 2.7.2 on my M1 Macbook with &lt;a href=&quot;https://brew.sh&quot;&gt;Homebrew&lt;/a&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;asdf&lt;/code&gt;. But because under the hood &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;asdf&lt;/code&gt; use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rbenv&lt;/code&gt;, I assume it should work too with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rbenv&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;My Macbook specifications:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;MacBook Pro (13-inch, M1, 2020)&lt;/li&gt;
  &lt;li&gt;Chip Apple M1&lt;/li&gt;
  &lt;li&gt;macOS Monterey version 12.1&lt;/li&gt;
  &lt;li&gt;Memory 16GB&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;1-install-or-upgrade-asdf-and-asdf-ruby&quot;&gt;1. Install or Upgrade asdf and asdf-ruby&lt;/h2&gt;

&lt;p&gt;Install &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;asdf&lt;/code&gt; and add Ruby plugin to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;asdf&lt;/code&gt;.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;brew &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;asdf
asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Or upgrade existing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;asdf&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;asdf-ruby&lt;/code&gt; plugin.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;brew upgrade asdf
asdf plugin update ruby&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;2-install-ruby&quot;&gt;2. Install Ruby&lt;/h2&gt;

&lt;h3 id=&quot;version-271&quot;&gt;Version 2.7.1&lt;/h3&gt;

&lt;p&gt;Add the following ENV variable to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.zshrc&lt;/code&gt;.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;RUBY_CFLAGS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;-Wno-error=implicit-function-declaration&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;And install Ruby 2.7.1 with the following command.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;asdf &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;ruby 2.7.1&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;If the installation is successful, run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;asdf list&lt;/code&gt;, it will shows Ruby 2.7.1.&lt;/p&gt;

&lt;h3 id=&quot;version-272&quot;&gt;Version 2.7.2&lt;/h3&gt;

&lt;p&gt;If Ruby is already installed, reinstall the current versions of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;openssl&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;readline&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ruby-build&lt;/code&gt; in order to have the latest versions and configs.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;brew uninstall &lt;span class=&quot;nt&quot;&gt;--ignore-dependencies&lt;/span&gt; readline
brew uninstall &lt;span class=&quot;nt&quot;&gt;--ignore-dependencies&lt;/span&gt; openssl
brew uninstall &lt;span class=&quot;nt&quot;&gt;--ignore-dependencies&lt;/span&gt; ruby-build
&lt;span class=&quot;nb&quot;&gt;rm&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-rf&lt;/span&gt; /opt/homebrew/etc/openssl@1.1
brew &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; readline
brew &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; openssl
brew &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; ruby-build&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;add the following ENV variables to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.zshrc&lt;/code&gt;.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;RUBY_CONFIGURE_OPTS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;--with-openssl-dir=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;brew &lt;span class=&quot;nt&quot;&gt;--prefix&lt;/span&gt; openssl@1.1&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;LDFLAGS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;-L/opt/homebrew/opt/readline/lib&quot;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;CPPFLAGS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;-I/opt/homebrew/opt/readline/include&quot;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;PKG_CONFIG_PATH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;/opt/homebrew/opt/readline/lib/pkgconfig&quot;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;optflags&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;-Wno-error=implicit-function-declaration&quot;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;LDFLAGS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;-L/opt/homebrew/opt/libffi/lib&quot;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;CPPFLAGS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;-I/opt/homebrew/opt/libffi/include&quot;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;PKG_CONFIG_PATH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;/opt/homebrew/opt/libffi/lib/pkgconfig&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Install Ruby 2.7.2 with the following command.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;asdf &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;ruby 2.7.2&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;If the installation is successful, run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;asdf list&lt;/code&gt;, it will shows Ruby 2.7.2.&lt;/p&gt;

&lt;p&gt;Based on &lt;a href=&quot;https://stackoverflow.com/questions/69012676/install-older-ruby-versions-on-a-m1-macbook&quot;&gt;Stack Overflow&lt;/a&gt;, above ENV variables should work too on Ruby 2.6.x, but I’ve never tried to install Ruby 2.6.x.&lt;/p&gt;

&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://dev.to/truemark/fix-issue-while-installing-ruby-with-rbenv-in-m1-mac-3dfd&quot;&gt;[Fix] Issue while Installing Ruby with Rbenv in M1 Mac&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://stackoverflow.com/questions/69012676/install-older-ruby-versions-on-a-m1-macbook&quot;&gt;Install older Ruby versions on a M1 MacBook?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
        <pubDate>Wed, 12 Jan 2022 09:20:00 +0700</pubDate>
        <link>https://www.railsmine.net/2022/01/install-old-version-ruby-m1-mac.html</link>
        <guid isPermaLink="true">https://www.railsmine.net/2022/01/install-old-version-ruby-m1-mac.html</guid>
        
        <category>asdf</category>
        
        <category>rbenv</category>
        
        <category>mac</category>
        
        <category>macbook</category>
        
        <category>apple</category>
        
        
        <category>ruby</category>
        
      </item>
    
      <item>
        <title>Railsmine Newsletter #2</title>
        <description>&lt;h2 id=&quot;ruby&quot;&gt;Ruby&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://silverhammermba.github.io/emberb/&quot;&gt;The Definitive Guide to Ruby’s C API&lt;/a&gt; - This site is a complete, practical guide to using Ruby’s C API&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://frantic.im/back-to-rails&quot;&gt;Moving my serverless project to Ruby on Rails&lt;/a&gt; - With serverless, Author was no longer dealing with his project’s domain, he was dealing with the distributed system’s domain.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://codeincomplete.com/articles/ruby-daemons/&quot;&gt;Daemonizing Ruby Processes&lt;/a&gt; - This old posr (2014) explains step-by-step how to daemonizing Ruby processes.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.simplethread.com/ruby-on-rails-in-a-week/&quot;&gt;Ruby on Rails in a Week&lt;/a&gt; - This post explains about how author is in the situation of having to learn Ruby on Rails in 7 days for interview process. Good read for beginner.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://chrisseaton.com/truffleruby/ruby-stm/&quot;&gt;Context on STM in Ruby&lt;/a&gt; - There’s a proposal to add &lt;em&gt;Software Transactional Memory&lt;/em&gt;, or &lt;em&gt;STM&lt;/em&gt;, to the Ruby programming language. This is part of a wider effort to add better support for concurrency and parallelism in Ruby, and in particular the idea of &lt;em&gt;ractors&lt;/em&gt;. A concept has been &lt;a href=&quot;https://bugs.ruby-lang.org/issues/17261&quot;&gt;proposed&lt;/a&gt; and &lt;a href=&quot;https://github.com/ruby/ruby/pull/3652&quot;&gt;implemented&lt;/a&gt; by Koichi Sasada.&lt;/p&gt;

&lt;h2 id=&quot;postgresql&quot;&gt;PostgreSQL&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://www.cybertec-postgresql.com/en/uuid-serial-or-identity-columns-for-postgresql-auto-generated-primary-keys/&quot;&gt;UUID, serial or identity columns for PostgreSQL auto-generated primary keys?&lt;/a&gt; - Sometimes customers ask me about the best choice for auto-generated primary keys. In this article, I’ll explore the options and give recommendations&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://rbranson.medium.com/10-things-i-hate-about-postgresql-20dbab8c2791&quot;&gt;10 Things I Hate About PostgreSQL&lt;/a&gt; - List of PostgreSQL’s imperfections based on author perspective.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.narrator.ai/blog/using-postgresql-as-a-data-warehouse/&quot;&gt;Using PostgreSQL as a Data Warehouse&lt;/a&gt; - With some tweaking PostgreSQL can be a great data warehouse. Here’s how to configure it.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://supabase.io/blog/2020/07/09/postgresql-templates&quot;&gt;What are PostgreSQL Templates?&lt;/a&gt; - In this post, author explores about template databases in PostgreSQL and make full use of their potential.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.cybertec-postgresql.com/en/how-to-interpret-postgresql-explain-analyze-output/&quot;&gt;How to interpret PostgreSQL EXPLAIN ANALYZE output&lt;/a&gt; - EXPLAIN ANALYZE is the key to optimizing SQL statements in PostgreSQL. This post explains what to look for and show you some helpful tools to visualize the output.&lt;/p&gt;
</description>
        <pubDate>Sun, 06 Jun 2021 14:26:00 +0700</pubDate>
        <link>https://www.railsmine.net/2021/06/railsmine-news-2.html</link>
        <guid isPermaLink="true">https://www.railsmine.net/2021/06/railsmine-news-2.html</guid>
        
        <category>newsletter</category>
        
        
        <category>newsletter</category>
        
      </item>
    
      <item>
        <title>Railsmine Newsletter #1</title>
        <description>&lt;p&gt;First Issue of Railsmine News. Railsmine News is a collection of Ruby and PostgreSQL news and tutorial. Hope you enjoy it.&lt;/p&gt;

&lt;h2 id=&quot;ruby&quot;&gt;Ruby&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mike-bourgeous/mb-geometry&quot;&gt;mb-geometry&lt;/a&gt; - Recreational Ruby tools for geometry. This ranges from simple functions like area calculation and line intersection, to Delaunay triangulation and Voronoi partitions.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://dragonruby.itch.io/&quot;&gt;DragonRuby&lt;/a&gt; - DragonRuby creates toolchains that allow developers the ability to build apps and games using a programming language called Ruby.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://blog.appsignal.com/2021/04/14/ruby-on-rails-controller-patterns-and-anti-patterns.html&quot;&gt;Ruby on Rails Controller Patterns and Anti-patterns&lt;/a&gt; - Previously, author covered patterns and anti-patterns in general as well as in relation to Rails Models and Views. In this post, author are going to analyze the final part of the MVC (Model-View-Controller) design pattern — the Controller.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://blog.engineyard.com/the-ruby-unbundled-series-release-features-faster-by-slowing-down&quot;&gt;The Ruby Unbundled Series: Release Features Faster by Slowing Down&lt;/a&gt; - There is a saying that in order to speed up, you need to slow down. This is true in software development in that we want to control the rate at which users receive new features.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://keygen.sh/blog/how-to-implement-api-key-authentication-in-rails-without-devise/&quot;&gt;How to Implement API Key Authentication in Rails Without Devise&lt;/a&gt; - When it comes to authentication, Ruby on Rails is a batteries-included framework. Devise is over-kill for an API.&lt;/p&gt;

&lt;h2 id=&quot;postgresql&quot;&gt;PostgreSQL&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://wiki.postgresql.org/wiki/TOAST&quot;&gt;TOAST&lt;/a&gt; - TOAST is a mechanism PostgreSQL uses to keep physical data rows from exceeding the size of a data block (typically 8KB). Postgres does not support physical rows that cross block boundaries, so the block size is a hard upper limit on row size.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.cybertec-postgresql.com/en/getting-started-qgis-postgresql-postgis/&quot;&gt;Getting started with QGIS, PostgreSQL and PostGIS&lt;/a&gt; - In this mini-tutorial, you will learn how to quickly visualize OpenStreetMap (OSM) data with PostGIS and QGIS.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.kubegres.io/&quot;&gt;Kubegres&lt;/a&gt; - Kubegres is a Kubernetes operator allowing to deploy a cluster of PostgreSql instances with data replication enabled out-of-the box. It brings simplicity when using PostgreSql considering how complex managing stateful-set’s life-cycle and data replication could be with Kubernetes.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://onesignal.com/blog/lessons-learned-from-5-years-of-scaling-postgresql/&quot;&gt;Lessons Learned From 5 Years of Scaling PostgreSQL&lt;/a&gt; - A must read tips.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://iamsafts.com/posts/postgres-gin-performance/&quot;&gt;Debugging random slow writes in PostgreSQL&lt;/a&gt; - Understanding &amp;amp; mitigating randomly slow writes in PostgreSQL.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://adamj.eu/tech/2021/04/13/reindexing-all-tables-after-upgrading-to-postgresql-13/&quot;&gt;Reindexing all tables after upgrading to PostgreSQL 13&lt;/a&gt; - Author reindexed all tables after the upgrade and saw index storage savings of up to 90%.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://aws.amazon.com/blogs/database/is-amazon-rds-for-postgresql-or-amazon-aurora-postgresql-a-better-choice-for-me/&quot;&gt;Is Amazon RDS for PostgreSQL or Amazon Aurora PostgreSQL a better choice for me?&lt;/a&gt; - In this post, author explains how to determine the best option between Amazon RDS for PostgreSQL and Aurora PostgreSQL for your workloads and business requirements.&lt;/p&gt;

</description>
        <pubDate>Thu, 22 Apr 2021 06:58:00 +0700</pubDate>
        <link>https://www.railsmine.net/2021/04/railsmine-news-1.html</link>
        <guid isPermaLink="true">https://www.railsmine.net/2021/04/railsmine-news-1.html</guid>
        
        <category>newsletter</category>
        
        
        <category>newsletter</category>
        
      </item>
    
  </channel>
</rss>
