Ervan L.

Caring for Bugs: In code for tech progress, in nature for harmony 🦋 | Founder @ RedGems.dev | Freelance Ruby Developer

Ervan L. boosted:
2025-07-04
Ervan L. boosted:
Hans Schnedlitzhschne@ruby.social
2025-07-03

If you're working with database extensions, it can be helpful to exclude tables added by your extensions from your schema file. Keep it free from clutter! 🧹

The example shows SQLite and Spatialite, should work with any database and extension though.

#ruby #rubyonrails

Ervan L. boosted:
Will Richardsonwillhbr@ruby.social
2025-06-30

TIL that the Ruby interpreter won't load a file with a shebang line that doesn't contain "ruby"

This fails:
#!/bin/gem-language
#!some-wrapper-for-ruuuuby

But this is fine:
#!aaarubyeee
#!/random/nonexistent/directory/ruby

Ervan L. boosted:
Hans Schnedlitzhschne@ruby.social
2025-06-26

I use SVGs a lot - and so should you! They're great.

Here's how you easily inline them. No need for any additional gems. Twelve lines of helper method are all you need 👌

#ruby #rubyonrails

Ervan L. boosted:
Curated Hacker NewsCuratedHackerNews
2025-05-12

Ruby 3.5 Feature: Namespace on read

bugs.ruby-lang.org/issues/21311

Ervan L. boosted:
Hans Schnedlitzhschne@ruby.social
2025-04-03

If you're creating a reasonably complex Thor CLI, you'll likely want to reuse common method options. Here's a simple way to do that.

#ruby #rubyonrails

Ervan L. boosted:
Hans Schnedlitzhschne@ruby.social
2025-03-25

TIL: You can pass modifies to generators using curly braces. For example, create a decimal column with precision and scale 🤩

#ruby #rubyonrails

Ervan L. boosted:
Bradley Schaefersoulcutter@ruby.social
2025-03-21

I got to pull out a nice RSpec trick today - using compound expectations.

I wanted to check that a method was called with a (rather large) string that had a few different substrings in it.

expect(instance).to receive(:method).with(
a_string_including("thing 1") &
a_string_including(obj.message) &
a_string_including("asdfasdfgasd")
)

The trick here is combining matchers with &

There's other ways you might do this, but the test output is really nice this way.

#ruby #rspec

2025-03-20

TIL; defining a route in Rails 8 automatically defines an empty action that renders the matching view.

No more boilerplate generating empty method in my controller such as

def show; end

#ruby #rails

Ervan L. boosted:
Hans Schnedlitzhschne@ruby.social
2025-03-14

TIL: graphql-ruby supports async data loaders out of the box. A must have if you have fields that do network requests when resolved.

#rubyonrails #graphql

graphql-ruby.org/dataloader/as

Ervan L. boosted:
Kuba Suder • @mackuba.eu on 🦋mackuba@martianbase.net
2025-02-19

TIL there's an ISO8601 notation for time *intervals* too… 🧐

#ruby #rails

Calling iso8601 on negative durations retains the negative sign on individual digits instead of prepending it.

This change is required so we can interoperate with PostgreSQL, which prefers negative signs for each component.

Compatibility with other iso8601 parsers which support leading negatives as well as negatives per component is still retained.

Before:

(-1.year - 1.day).iso8601
# => "-P1Y1D"
After:

(-1.year - 1.day).iso8601
# => "P-1Y-1D"
Ervan L. boosted:
2025-02-04

Good progress writing a #ruby SDK for Datastar. This is a simple Rack app streaming UI updates to the browser from two different threads.

2025-02-03

@joeldrapper I think I'm in this scenario (with some more overhead) because I have plain SLIM content that are aggregated before or after the view_template.

Thanks a lot for your explanations, I now gets why my helpers are being call in the before_template using vanish.

I'll keep digging, using your example as documentation \o/

2025-02-03

I need to migrate an "old" framework based on #phlex . I'm working on adding the deferred rendering to our existing stack; and can't wrap my head around what that `vanish(&)` thing do.

So many unexpected behaviours, if only we had time to do this more thoughtfully at first.

Ervan L. boosted:
Mike Perham :sidekiq:getajobmike@ruby.social
2025-01-24

Are you an engineer and want to make a difference?

1. Try out Hanami. hanamirb.org
2. Support Ruby Central rubycentral.org
3. Support Mastodon. It's the only billionaire-proof social media.

Ervan L. boosted:
Bozhidar Batsov (a.k.a. Bug)bbatsov@hachyderm.io
2025-01-23

RuboCop 1.71 is out! Lots of small improvement in this release (see for all the details github.com/rubocop/rubocop/rel), but I'd like to highlight that supposedly now RuboCop handles properly safe navigation in every single cop!

It only took us 8 years to get there! 😅

#Ruby

Ervan L. boosted:
2025-01-15

A simple trick to understand Ruby’s lazy enumerator

joyofrails.com/articles/simple

Beautiful visual demo of how lazy enumerators help avoid unnecessary work.

#ruby

2025-01-04

Actually playing with #phlex and #literal in #ruby on #rails and it feels awesome. Rock solid gems !

Client Info

Server: https://mastodon.social
Version: 2025.04
Repository: https://github.com/cyevgeniy/lmst