<?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 Diego Amaya on Medium]]></title>
        <description><![CDATA[Stories by Diego Amaya on Medium]]></description>
        <link>https://medium.com/@diegodev9?source=rss-761cc8f16cbb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*g6m4o55kTmboFgVjJswWPg.png</url>
            <title>Stories by Diego Amaya on Medium</title>
            <link>https://medium.com/@diegodev9?source=rss-761cc8f16cbb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 16:01:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@diegodev9/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[Setup ufw in AWS and forgot to allow ssh (port 22)]]></title>
            <link>https://medium.com/@diegodev9/setup-ufw-in-aws-and-forgot-to-allow-ssh-port-22-7c0d2af5c571?source=rss-761cc8f16cbb------2</link>
            <guid isPermaLink="false">https://medium.com/p/7c0d2af5c571</guid>
            <category><![CDATA[ssh]]></category>
            <category><![CDATA[ufw]]></category>
            <category><![CDATA[aws-ec2]]></category>
            <dc:creator><![CDATA[Diego Amaya]]></dc:creator>
            <pubDate>Mon, 21 Jul 2025 18:10:10 GMT</pubDate>
            <atom:updated>2025-07-21T18:10:10.631Z</atom:updated>
            <content:encoded><![CDATA[<p>Welcome my brother/sister!<br>If you’re here, then you (like me) forgot to allow port 22 when you installed ufw in your ec2 instance and you don’t know how to get inside your instance now.</p><p>Please follow this steps:<br>- Inside your ec2 panel look for your instance and stop it<br>- Click on actions -&gt; Edit User Data<br>- Copy/paste this:</p><pre>Content-Type: multipart/mixed; boundary=&quot;//&quot;<br>MIME-Version: 1.0<br>--//<br>Content-Type: text/cloud-config; charset=&quot;us-ascii&quot;<br>MIME-Version: 1.0<br>Content-Transfer-Encoding: 7bit<br>Content-Disposition: attachment; filename=&quot;cloud-config.txt&quot;<br>#cloud-config<br>cloud_final_modules:<br>- [scripts-user, always]<br>--//<br>Content-Type: text/x-shellscript; charset=&quot;us-ascii&quot;<br>MIME-Version: 1.0<br>Content-Transfer-Encoding: 7bit<br>Content-Disposition: attachment; filename=&quot;userdata.txt&quot;<br>#!/bin/bash<br>ufw disable<br>iptables -L<br>iptables -F<br>--//</pre><p>Restart your instace and ssh should work again.</p><p>You’re welcome!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7c0d2af5c571" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My javascript is not loading properly when I change through pages!]]></title>
            <link>https://medium.com/@diegodev9/my-javascript-is-not-loading-properly-when-i-change-through-pages-c5e6e8eb90d5?source=rss-761cc8f16cbb------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5e6e8eb90d5</guid>
            <category><![CDATA[rails-8]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[cdn]]></category>
            <category><![CDATA[rails-7]]></category>
            <category><![CDATA[rails-6]]></category>
            <dc:creator><![CDATA[Diego Amaya]]></dc:creator>
            <pubDate>Mon, 03 Feb 2025 10:41:14 GMT</pubDate>
            <atom:updated>2025-02-03T10:41:14.194Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*zk3sRW_ZKJwFZ9uw8mef-Q.jpeg" /></figure><p>So, you have added all your javascript code and/or cdn to your amazing ruby on rails app but is not working the way you expected…</p><p>Go to your application.html.erb and add the following line:</p><p>For Ruby on Rails 6:</p><pre>&lt;head&gt;<br>  ...some meta tags<br>  &lt;meta name=&quot;turbolinks-visit-control&quot; content=&quot;reload&quot;&gt;<br>&lt;/head&gt;</pre><p>For Ruby on Rails 7 / 8:</p><pre>&lt;head&gt;<br>  ...some meta tags<br>  &lt;meta name=&quot;turbo-visit-control&quot; content=&quot;reload&quot;&gt;<br>&lt;/head&gt;</pre><p>And that’s it!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*wFAaPmmL0zlm7B2YzAcEjQ.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5e6e8eb90d5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bootstrap 5 + Fontawesome 6 on ruby on rails 7 / 7.2 using importmap]]></title>
            <link>https://medium.com/@diegodev9/bootstrap-5-fontawesome-6-on-ruby-on-rails-7-7-2-using-importmap-fcc9219b5eb5?source=rss-761cc8f16cbb------2</link>
            <guid isPermaLink="false">https://medium.com/p/fcc9219b5eb5</guid>
            <category><![CDATA[ruby-on-rails-7]]></category>
            <category><![CDATA[importmap]]></category>
            <category><![CDATA[bootstrap-5]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[font-awesome-6]]></category>
            <dc:creator><![CDATA[Diego Amaya]]></dc:creator>
            <pubDate>Sun, 29 Sep 2024 13:33:48 GMT</pubDate>
            <atom:updated>2025-01-26T19:38:59.335Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fDMB8wt450pIRxw18d492A.png" /></figure><h3>Bootstrap 5 + Fontawesome 6 on ruby on rails 7 / 8 using importmap</h3><p>Hey guys! I want to show you how to install bootstrap 5.3.3 and font awesome 6.6.0 on ruby on rails 7 +</p><p>Let’s start with font awesome:</p><p>In your recently created project with ruby on rails 7.2, you need to have at least one controller and view created to test out the icons are showing</p><pre>rails g controller home index</pre><p>Now add fontawesome from the command line:</p><pre>./bin/importmap pin @fortawesome/fontawesome-free</pre><p>Now got to config/importmap.rb and you’ll se the following code:</p><pre>pin &quot;@fortawesome/fontawesome-free&quot;, to:&quot;@fontawesome--fontawesome-free.js&quot;</pre><p>We need to change that line into this:</p><pre>pin &quot;@fortawesome/fontawesome-free&quot;, to: &quot;@fortawesome/fontawesome-free@6.7.2/js/all.js&quot;&gt;https://ga.jspm.io/npm:@fortawesome/fontawesome-free@6.7.2/js/all.js&quot;</pre><p>In your app/javascript/application.js add this:</p><pre>import &quot;@fortawesome/fontawesome-free&quot;;</pre><p>And now we are ready to test if this is working. <br>Go to your home/index view and add some fontawesome icons:</p><pre>&lt;!-- normal icons --&gt;<br>&lt;i class=&quot;fa-solid fa-flag&quot;&gt;&lt;/i&gt;<br>&lt;i class=&quot;fa-brands fa-amazon&quot;&gt;&lt;/i&gt;<br>&lt;i class=&quot;fa-regular fa-bell&quot;&gt;&lt;/i&gt;<br><br>&lt;!-- animated icons --&gt;<br>&lt;i class=&quot;fa-solid fa-refresh fa-2xl fa-spin&quot;&gt;&lt;/i&gt;<br>&lt;i class=&quot;fa-solid fa-gem fa-rotate-180&quot;&gt;&lt;/i&gt;<br>&lt;i class=&quot;fa-solid fa-gem fa-rotate-by&quot; style=&quot;color: green; --fa-rotate-angle: 45deg&quot;&gt;&lt;/i&gt;<br>&lt;i class=&quot;fa-brands fa-youtube&quot; style=&quot;color: red;&quot;&gt;&lt;/i&gt;<br>&lt;i class=&quot;fa-regular fa-bell fa-beat&quot;&gt;&lt;/i&gt;</pre><p>And that’s it! you have fontawesome in your rails 7.2 project working</p><p>Now got with bootstrap:</p><p>Add this two gems to your Gemfile</p><pre>gem &quot;bootstrap&quot;<br>gem &quot;sassc-rails&quot;</pre><p>Then run bundle install:</p><pre>bundle install</pre><p>After installing those gems we need to change our application.css to application.scss (app/assets/stylesheets/application.css).<br>Then open app/assets/stylesheets/application.scss and add this line</p><pre>@import &quot;bootstrap&quot;;</pre><p>Now got to app/javascript/application.js and add this:</p><pre>import &quot;popper&quot;<br>import &quot;bootstrap&quot;</pre><p>Open config/importmap.rb and add these lines:</p><pre>pin &quot;popper&quot;, to: &#39;popper.js&#39;, preload: true<br>pin &quot;bootstrap&quot;, to: &#39;bootstrap.min.js&#39;, preload: true</pre><p>The last thing is to add a line into config/initializers/assets.rb:</p><pre>Rails.application.config.assets.precompile += %w[bootstrap.min.js popper.js]</pre><p>Now we’re going to test this out.<br>Open your app/views/home/index.html that we’ve created before and add some bootstrap:</p><pre>&lt;nav class=&quot;navbar navbar-expand-lg bg-body-tertiary&quot;&gt;<br>  &lt;div class=&quot;container-fluid&quot;&gt;<br>    &lt;a class=&quot;navbar-brand&quot; href=&quot;#&quot;&gt;Navbar&lt;/a&gt;<br>    &lt;button class=&quot;navbar-toggler&quot; type=&quot;button&quot; data-bs-toggle=&quot;collapse&quot; data-bs-target=&quot;#navbarSupportedContent&quot; aria-controls=&quot;navbarSupportedContent&quot; aria-expanded=&quot;false&quot; aria-label=&quot;Toggle navigation&quot;&gt;<br>      &lt;span class=&quot;navbar-toggler-icon&quot;&gt;&lt;/span&gt;<br>    &lt;/button&gt;<br>    &lt;div class=&quot;collapse navbar-collapse&quot; id=&quot;navbarSupportedContent&quot;&gt;<br>      &lt;ul class=&quot;navbar-nav me-auto mb-2 mb-lg-0&quot;&gt;<br>        &lt;li class=&quot;nav-item&quot;&gt;<br>          &lt;a class=&quot;nav-link active&quot; aria-current=&quot;page&quot; href=&quot;#&quot;&gt;Home&lt;/a&gt;<br>        &lt;/li&gt;<br>        &lt;li class=&quot;nav-item&quot;&gt;<br>          &lt;a class=&quot;nav-link&quot; href=&quot;#&quot;&gt;Link&lt;/a&gt;<br>        &lt;/li&gt;<br>        &lt;li class=&quot;nav-item dropdown&quot;&gt;<br>          &lt;a class=&quot;nav-link dropdown-toggle&quot; href=&quot;#&quot; role=&quot;button&quot; data-bs-toggle=&quot;dropdown&quot; aria-expanded=&quot;false&quot;&gt;<br>            Dropdown<br>          &lt;/a&gt;<br>          &lt;ul class=&quot;dropdown-menu&quot;&gt;<br>            &lt;li&gt;&lt;a class=&quot;dropdown-item&quot; href=&quot;#&quot;&gt;Action&lt;/a&gt;&lt;/li&gt;<br>            &lt;li&gt;&lt;a class=&quot;dropdown-item&quot; href=&quot;#&quot;&gt;Another action&lt;/a&gt;&lt;/li&gt;<br>            &lt;li&gt;&lt;hr class=&quot;dropdown-divider&quot;&gt;&lt;/li&gt;<br>            &lt;li&gt;&lt;a class=&quot;dropdown-item&quot; href=&quot;#&quot;&gt;Something else here&lt;/a&gt;&lt;/li&gt;<br>          &lt;/ul&gt;<br>        &lt;/li&gt;<br>        &lt;li class=&quot;nav-item&quot;&gt;<br>          &lt;a class=&quot;nav-link disabled&quot; aria-disabled=&quot;true&quot;&gt;Disabled&lt;/a&gt;<br>        &lt;/li&gt;<br>      &lt;/ul&gt;<br>      &lt;form class=&quot;d-flex&quot; role=&quot;search&quot;&gt;<br>        &lt;input class=&quot;form-control me-2&quot; type=&quot;search&quot; placeholder=&quot;Search&quot; aria-label=&quot;Search&quot;&gt;<br>        &lt;button class=&quot;btn btn-outline-success&quot; type=&quot;submit&quot;&gt;Search&lt;/button&gt;<br>      &lt;/form&gt;<br>    &lt;/div&gt;<br>  &lt;/div&gt;<br>&lt;/nav&gt;</pre><p>Everything should be working, including dropdowns and popups.</p><p>That’s it!</p><p><em>Aditional information: If you don’t get bootstrap class suggestion on your code editor, try installing them with your favourite node packager:</em></p><pre>yarn add bootstrap@v5.3.3</pre><pre>bun add boostrap@v5.3.3</pre><pre>npm install bootstrap@v5.3.3</pre><p><strong><em>Reference: </em></strong><em><br></em><strong><em>fontawesome:</em></strong><em> https://www.linkedin.com/pulse/how-install-fontawesome-rails-7-using-importmaps-without-habib/<br></em><strong><em>bootstrap:</em></strong><em> https://www.linkedin.com/pulse/rails-7-bootstrap-52-importmap-md-habibur-rahman-habib/</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fcc9219b5eb5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Problem with babel in rails?]]></title>
            <link>https://medium.com/@diegodev9/problem-with-babel-in-rails-f852f34f508a?source=rss-761cc8f16cbb------2</link>
            <guid isPermaLink="false">https://medium.com/p/f852f34f508a</guid>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[babeljs]]></category>
            <dc:creator><![CDATA[Diego Amaya]]></dc:creator>
            <pubDate>Wed, 16 Aug 2023 14:12:59 GMT</pubDate>
            <atom:updated>2024-09-29T13:00:37.891Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*jG0xC-XfAhLVjEgD.jpg" /></figure><p>Using rails 6.1.7.x and ruby 3.1.2.<br>Error: Cannot find package ‘<a href="http://twitter.com/babel/plugin-proposal-private-m">@babel/plugin-proposal-private-m</a>ethods’</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5yoTGPCSspfjPuuQkvWllQ.png" /></figure><p>So, you’re looking for the magic solution ... it’s pretty simple.<br>All you have to do is use yarn to install the missing dependencies, like this:</p><pre>yarn add @babel/plugin-proposal-private-methods — dev<br>yarn add @babel/plugin-proposal-private-property-in-object</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/0*uKJVdzHNDXG54mh9.jpeg" /></figure><p>And that’s it!! rails is compiling perfectly again.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f852f34f508a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DEVISE-JWT is not sending Authorization response on headers]]></title>
            <link>https://medium.com/@diegodev9/devise-jwt-is-not-sending-authorization-response-on-headers-6f852d70fde?source=rss-761cc8f16cbb------2</link>
            <guid isPermaLink="false">https://medium.com/p/6f852d70fde</guid>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[devise-jwt]]></category>
            <category><![CDATA[devise]]></category>
            <dc:creator><![CDATA[Diego Amaya]]></dc:creator>
            <pubDate>Sat, 20 May 2023 20:43:19 GMT</pubDate>
            <atom:updated>2024-09-29T13:01:45.028Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/220/0*EHBXu-z3JXrlWCOx.gif" /></figure><p>After looking all over the internet, I’ve found the solution and it’s very simple.</p><p>First, you need to check your rake-cors config (this is mine)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*Dgz0tb91BJs2E6XCznLLpw.png" /></figure><p>If you are using a custom namespace for devise login like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/479/1*-StJf03-OscEJLBpLW3bPg.png" /></figure><p>Then, you need to create the respective files and folders like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*LetFpHBjNozxbRvAPnkh8A.png" /></figure><p>After that, you have to edit your config/initializers/devise.rb and put this inside Devise.setup do |config|</p><pre>config.jwt do |jwt|<br> jwt.secret = Rails.application.credentials.fetch(:secret_key_base)<br> jwt.expiration_time = 1.hour.to_i<br> jwt.dispatch_requests = [<br> [‘POST’, %r{/api/v1/users/sign_in$}]<br> ]<br> jwt.revocation_requests = [<br> [‘DELETE’, %r{/api/v1/users/sign_out$}]<br> ]<br>end</pre><p>And for the last part, you have to create a custom sign_in inside app/controllers/api/v1/users/sessions_controller.rb like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*OKLDzLRMB0RKRZi7A_x38w.png" /></figure><p>Don’t forget to create the find_user method for that @user<br>(this is an example)</p><pre>def set_user<br> @user = User.find_by(email: params[:user][:email])<br>end</pre><p>and call that method:</p><pre>class SessionsController &lt; Devise::SessionsController<br> …<br> before_action :set_user<br>…<br>end</pre><p>And now you are ready to test your sign_in endpoint with postman or curl<br>to get the authorization bearer on the response headers</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6f852d70fde" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Grover is not accepting my stylesheets when printing PDF]]></title>
            <link>https://medium.com/@diegodev9/grover-is-not-accepting-my-stylesheets-when-printing-pdf-b430e1cf41dc?source=rss-761cc8f16cbb------2</link>
            <guid isPermaLink="false">https://medium.com/p/b430e1cf41dc</guid>
            <category><![CDATA[pdf]]></category>
            <category><![CDATA[grover]]></category>
            <category><![CDATA[html-to-pdf]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <dc:creator><![CDATA[Diego Amaya]]></dc:creator>
            <pubDate>Mon, 15 May 2023 10:44:40 GMT</pubDate>
            <atom:updated>2024-09-29T13:05:32.460Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*VSIkpGL_uzC4rPta.jpg" /></figure><p>First, you need to check out your config/initializers/grover.rb</p><pre>Grover.configure do |config|<br> config.options = {<br> format: ‘A4’,<br> margin: {<br> top: ‘50px’,<br> bottom: ‘50px’<br> },<br> user_agent: ‘Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0’,<br> viewport: {<br> width: 640,<br> height: 480<br> },<br> prefer_css_page_size: true,<br> emulate_media: ‘screen’,<br> bypass_csp: true,<br> media_features: [{ name: ‘prefers-color-scheme’, value: ‘dark’ }],<br> # timezone: ‘Argentina/Neuquen’,<br> vision_deficiency: ‘deuteranopia’,<br> extra_http_headers: { ‘Accept-Language’: ‘es-ES’ },<br> # geolocation: { latitude: 59.95, longitude: 30.31667 },<br> # focus: ‘#some-element’,<br> # hover: ‘#another-element’,<br> cache: false,<br> timeout: 0, # Timeout in ms. A value of `0` means ‘no timeout’<br> # request_timeout: 1000, # Timeout when fetching the content (overloads the `timeout` option)<br> # convert_timeout: 2000, # Timeout when converting the content (overloads the `timeout` option, only applies to PDF conversion)<br> launch_args: [‘ — font-render-hinting=medium’],<br> wait_until: ‘domcontentloaded’,<br> print_background: true<br> }<br>end</pre><p>take a look at this part:</p><pre>timeout: 0, <br> # request_timeout: 1000, <br> # convert_timeout: 2000, <br>print_background: true</pre><p>It is important to comment request_timeout and convert_timeout, otherwise you will get a timeout error</p><p>The other important part is: <br><strong><em>print_background: true</em></strong></p><p>Don’t forget to add <strong><em>print_background: true, otherwise you will not get your stylesheets working</em></strong></p><p>Then (according to <a href="https://github.com/Studiosity/grover/blob/main/README.md">Grover’s documentation</a>), in your controller you need to call your view output file like this:</p><pre>_html = render_to_string({<br> template: ‘informes/show.html.erb’,<br> layout: ‘print.html.erb’<br> })<br>_pdf = Grover.new(_html, cookies: header_cookies).to_pdf<br>_file_name = ‘informe-’ + (params[:format]).to_s<br>File.open(“#{Rails.root}/public/#{_file_name}.pdf”, “w+b”) &lt;&lt; _pdf<br>redirect_to “/#{_file_name}.pdf”</pre><p>In the example above, I’m creating an output file for the PDF on my public folder and then calling it to print that out in my browser (<em>redirect_to</em>).</p><p>And that’s it.</p><p>Special mention: I’m sure you’re wondering what’s “cookies: header_cookies” means. According to <a href="https://github.com/Studiosity/grover/blob/main/README.md">Grover’s documentation</a>, this is how you give your cookies session to Grover (don’t forget to use Concerns for this, here is an example)</p><pre># app/controllers/concerns/stuff_for_grover.rb<br><br>module StuffForGrover<br> extend ActiveSupport::Concern<br><br>  def header_cookies<br>   request.headers[‘Cookie’].split(‘; ‘).map do |cookie|<br>     key, value = cookie.split ‘=’<br>     { name: key, value: value, domain: request.headers[‘Host’] }<br>   end<br>  end<br>end</pre><p>and then include that on your controller:</p><pre>class InformesController &lt; ApplicationController<br> …some before_action code here<br>include StuffForGrover<br>…</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b430e1cf41dc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bootstrap 5.3 + Rails 6 dropdown button not working?]]></title>
            <link>https://medium.com/@diegodev9/bootstrap-5-3-rails-6-dropdown-button-not-working-29e59b638be8?source=rss-761cc8f16cbb------2</link>
            <guid isPermaLink="false">https://medium.com/p/29e59b638be8</guid>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[dropdown-menu]]></category>
            <category><![CDATA[bootstrap-5]]></category>
            <dc:creator><![CDATA[Diego Amaya]]></dc:creator>
            <pubDate>Fri, 31 Mar 2023 14:02:02 GMT</pubDate>
            <atom:updated>2024-09-29T13:07:27.008Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/612/0*VBk8faii96rSXWiO" /></figure><p>If you already checked out everything is installed:</p><pre>yarn install bootstrap@next<br>yarn add jquery<br>yarn add @popperjs/core</pre><p>And you have configured webpack/environment.js:</p><pre>const { environment } = require(‘@rails/webpacker’)<br>const webpack = require(‘webpack’)<br>environment.plugins.prepend(‘Provide’, new webpack.ProvidePlugin({<br> $: ‘jquery/src/jquery’,<br> jQuery: ‘jquery/src/jquery’,<br> jquery: ‘jquery’<br>}))<br>module.exports = environment</pre><p>And also app/javascript/packs/application.js:</p><pre>import ‘jquery/dist/jquery’<br>import * as bootstrap from ‘bootstrap’<br>import ‘@fortawesome/fontawesome-free/css/all’<br>import ‘../stylesheets/application.scss’<br><br>document.addEventListener(“DOMContentLoaded”, function(event) {<br> let popoverTriggerList = [].slice.call(document.querySelectorAll(‘[data-bs-toggle=”popover”]’))<br> let popoverList = popoverTriggerList.map(function (popoverTriggerEl) {<br> return new bootstrap.Popover(popoverTriggerEl)<br> })<br>let tooltipTriggerList = [].slice.call(document.querySelectorAll(‘[data-bs-toggle=”tooltip”]’))<br> let tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {<br> return new bootstrap.Tooltip(tooltipTriggerEl)<br> })<br>let toastElList = [].slice.call(document.querySelectorAll(‘.toast’))<br> let toastList = toastElList.map(function(toastEl) {<br> return new bootstrap.Toast(toastEl)<br> })<br> toastList.forEach(toast =&gt; toast.show())<br>});</pre><p>And finally app/javascript/stylesheets/application.scss:</p><pre>@import “bootstrap/dist/css/bootstrap”;</pre><p>And you have everything working (tooltips, toast, popover) but your dropdown menu still isn’t working, it’s because you forgot to add an id and an aria-labelledby:</p><pre>&lt;li class=”nav-item dropdown”&gt;<br> &lt;a class=”nav-link dropdown-toggle” href=”#” id=”dropdownmenu1&quot; role=”button” data-bs-toggle=”dropdown” aria-expanded=”false”&gt;<br> Dropdown<br> &lt;/a&gt;<br> &lt;ul class=”dropdown-menu m-0&quot; aria-labelledby=”dropdownmenu1&quot;&gt;<br> &lt;li&gt;&lt;a class=”dropdown-item” href=”#”&gt;Action&lt;/a&gt;&lt;/li&gt;<br> &lt;li&gt;&lt;a class=”dropdown-item” href=”#”&gt;Another action&lt;/a&gt;&lt;/li&gt;<br> &lt;li&gt;&lt;hr class=”dropdown-divider”&gt;&lt;/li&gt;<br> &lt;li&gt;&lt;a class=”dropdown-item” href=”#”&gt;Something else here&lt;/a&gt;&lt;/li&gt;<br> &lt;/ul&gt;<br>&lt;/li&gt;</pre><p>That’s it! .. you are welcome.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29e59b638be8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to create enum data type with postgresql and ruby on rails 6]]></title>
            <link>https://medium.com/@diegodev9/how-to-create-enum-data-type-with-postgresql-and-ruby-on-rails-6-341a5740a280?source=rss-761cc8f16cbb------2</link>
            <guid isPermaLink="false">https://medium.com/p/341a5740a280</guid>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[postgresql]]></category>
            <dc:creator><![CDATA[Diego Amaya]]></dc:creator>
            <pubDate>Fri, 24 Mar 2023 13:59:58 GMT</pubDate>
            <atom:updated>2024-09-29T13:09:07.998Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/595/1*lQ9aYm4ckya3AOYVOG8SGQ.png" /></figure><h3>How to create enum data type with postgresql on ruby on rails 6</h3><p>If you are looking for some help with creating enum data types using postgresql, then you’re in the right place.</p><p>Add the gem activerecord-postgres_enum to your gemfile:</p><pre>gem ‘activerecord-postgres_enum’</pre><p>And run ‘bundle install’</p><p>For example, you need to create a new data type enum in your migration:</p><pre># migration<br>class CreatePerson &lt; ActiveRecord::Migration<br> def change<br>   create_enum :mood, %w(happy great never_better)<br>   create_table :person do |t|<br>     t.enum :person_mood, enum_name: :mood<br>   end<br> end<br>end</pre><p>And add this to your model:</p><pre># model<br>class Person &lt; ApplicationRecord<br> enum mood: { happy: &#39;happy&#39;, great: &#39;great&#39;, never_better: &#39;never_better&#39; }<br>end</pre><p>That’s it!</p><p>For more information, look into the repository: <br><a href="https://github.com/bibendi/activerecord-postgres_enum">https://github.com/bibendi/activerecord-postgres_enum</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*dTz5iHQzHaZHGUzoMdNvBA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=341a5740a280" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>