The Ruby and Rails community linklog
Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!
Submit a post
Post Preview
Note: Only the first pargraph is shown on the front page and overly long paragraphs may be broken up.
Metaprogramming Ruby cheatcheat
In this TIL note you can find several Ruby meta-programming examples: [more inside]
Ruby Testing Podcast: Continuous Integration, Deployment and Delivery
A conversation with Marko Anastasov about how he got started with programming and testing, as well as Continuous Integration, Continuous Deployment, Continuous Delivery and the difference among the three:
Free update to Everyday Rails Testing with RSpec
I’ve released an update to my book Everyday Rails Testing with RSpec with a brief intro to system specs, some fixes to address breaking changes in Devise and Geocoder, and a few other smaller fixes. As usual, this is a free update for all existing readers—sign into Leanpub to download a fresh copy. Thanks as always for your support!
Why the ruby CSV standard library is broken, broken, broken (and how to fix it)
Hello, I’ve written up an article titled “Why the CSV standard library is broken, broken, broken (and how to fix it)”. Let’s make ruby the best it can be for data wrangling - starting with the humble comma-separated values (CSV) format - the world’s most popular data interchange format in text :-). Questions and comments welcome. Cheers. Prost.
OpenStruct in Ruby
In this article, we’re going to explore the following topics:
Rubyflow
Hi, developers from could you please add a functionality to ignore “Author” of posts. I see a lot of spam here and articles about nothing (many companies just publishing articles to get better SEO). It could be a great feature. Thank you
From Service Objects to Interactors
This article discusses the Interactor gem as a robust implementation of the service object pattern and some suggestions for best practices when using it. [more inside]
Mastodon instance for Rubyists
You might've heard of Mastodon in the past, and recently there's been an increase in folks leaving Twitter for it. I've set up a Mastodon instance specifically for Rubyists, in the hope that it will help us create some new communities for sharing knowledge and techniques. [more inside]
csvreader - read tabular data in comma-separated values (csv) format the right way
Hello, I’ve started to put together a new library / gem, that is, csvreader - that lets you read tabular data in the comma-separated values (csv) format the right way :-), that is, uses best practices such as striping / trimming leading and trailing spaces, skipping comments and blank lines, “fixes” quote errors and more - all out-of-the-box with zero-configuration. and, thus, fixes some major bugs in the (old) standard csv library with a purpose-built parser (instead of a suppossed “faster” split(",") kludge). Happy data wrangling with ruby. Cheers. Prost.
Ruby Bitwise Operators
An operator is bitwise when instead of treating integers as whole numbers, it treats them as a sequence of bits. [more inside]
Migrate your apps to the new community-maintained trix gem: 'trix-rails'
Trix is a very popular gem that implements Basecamp ‘trix’ functionality. Unfortunately support has lapsed for the gem, and the community has launched a new supported gem.
Using Lambdas to Simplify Varying Behaviors in Your Code
This article discusses some techniques I’ve used to incorporate the benefits of functional programming into Ruby. Using enumerables and filters as examples, it shows how using callables such as lambdas can massively simplify the support of varying behaviors. [more inside]
Carrierwave: How to Avoid Issues with Version Inheritance
Сarrierwave is a popular image upload gem used by the Rails community to upload files to the server. Let’s see how to avoid issues with version inheritance. [more inside]
Struct in Ruby
In this article, we’re going to explore the following topics:
Spreadsheet Architect v3.1.0 Released!
Version 3.1.0 Spreadsheet Architect has now been released. One cool new enhancement added in this version is the conditional_row_styles option which enables you to create even more dynamic spreadsheets. Check the changelog for more details. https://github.com/westonganger/spreadsheet_architect
Ruby Memory Profiling in Practice
When I only started programming I thought that profiling and optimization is hard. A recent task at work inspired me to write a post with real life cases on how one would deal with memory issues. Hopping that this may be encouraging for someone 😁 [more inside]
Indexes on Rails: How to Make the Most of Your Postgres Database
Optimizing database queries is arguably one of the fastest ways to improve the performance of the Rails applications. There are multiple ways how you can approach it, depending on the kind of a problem. N+1 queries seem to be a pretty common issue, which is, fortunately, easy to address. However, sometimes you have some relatively simple-looking queries that seem to take way longer than they should be, indicating that they might require some optimization. The best way to improve such queries is adding a proper index. [more inside]
Learning How To Deploy Rails
This article is about deployment tools when we deploy Rails app such as Nginx, Passenger and Capistrano. It give you a brief introduction of these tools and the common features of them!
Metaprogramming: RUBY HOOK METHODS
Ruby comes with a bunch of hook methods that allow you to manipulate classes, modules and objects on the fly. [more inside]
How Ruby on Rails Speeds Up the Launch of Your Ecommerce Store
In this article, we review all the existing tools in Ruby on Rails that help developers and business owners launch an ecommerce store within short timeframe and with minimum efforts:
[Podcast] Ruby Rogues - How to Contribute to Ruby with Sihui Huang
In this episode of Ruby Rogues, the panel talks to Sihui Huang about his article “How to Contribute to Ruby”. Sihui is currently a back-end engineer at Gusto, which is a startup that works with payroll, benefits, and HR for companies. They talk about her experience in the programming world, why she chose to work with Ruby, and they touch on her article and why she decided to write it. They also touch on the three focuses for Ruby 3, if she thinks Ruby has a long time future, and more! [more inside]
tabreader - read in tabular datafiles in text in the tab format; incl. why Tab != CSV
Hello, I’ve put together a new library / gem, that is, tabreader - that lets you read in tabular datafiles in text in the tab format; yes, uses values = line.split("/t") or use the packaged up TabReader.parse_line( ... ) or any of the convenience helpers incl. TabHashReader.parse for returning hashes (with named value pairs) instead of arrays (with a list of values by position/index). The readme includes why CSV.read( col_sep: "\t", quote_char: "∅" ) is NOT recommended and why tab is its own (simpler) format than the classic comma-separated values (csv) format. Happy data wrangling with ruby. Cheers. Prost.
Adding Custom Search Bar To ActiveAdmin
Learn how to add a custom search bar in ActiveAdmin
Whyday is Sunday! #BeChunky
Learn about Whyday at @celebratewhyday:
Ruby logs and puts not shown in docker container logs
Given you are using Ruby 2.5.1 Docker image in Rails project, you may notice that no logs are beeing output to docker stdout (or docker compose stdout) output even when you configure your logger to be logger = Logger.new(STDOUT). [more inside]