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.
Who takes out your trash?
Rain Leander, Technical Program Manager for OpenStack at Red Hat, and Sanne Kalkman, software engineer, on Red Hat Linux and Ruby, and garbage collection respectively:
How to increase app performance by 5-20% (by optimizing rendering time)
crazy idea how to improve performance in your Rails application (if you using ERB, but maybe similar could be implemented for slim/haml/etc). [more inside]
ActiveStorage variants are persisting original image EXIF metadata
Imagine you are using Rails 5.2 ActiveStorage. Now you upload an image, render it with app.url_for my_model.image.variant(resize: '400x300') and discover that it’s rotated 90 deg to you would normally expect. You copy paste the link to the image to the browser and discover the image is rotated correctly. How is that possible? [more inside]
Backport support for embedded ERB in Slim views
for developers who are using Slim templates with embedded ERB. [more inside]
First explorations of GitHub's Actions
With the help of a friendly Hubber we set out to automate the workflow of releasing a Ruby gem, based off of the GitHub Action for npm:
Popularizing your Ruby gem
Once you’ve published your own ruby gem, learn what to do next to get the most out of it. Promote your ruby gem and engage with the developers in the Ruby community [more inside]
How to neatly organise assets in a Rails app
Rails comes packed with a lot of useful conventions. However, it doesn’t say much about how we should organise our front end assets. Here is a way in which we can leverage the same conventions we use to organise our controllers and views to have a neatly organised assets directory. [more inside]
Here to stay - Analyzing RubyGems stats for 2018
What’s up with Ruby? With all the ups and downs in 2018, is it dead or alive? Here at Infinum, we’ve done our research and compiled some stats so check it out. You’re welcome.
Time Zones From A Developer's Perspective
Have you ever wondered how timezones (correctly) works on Ruby on Rails, React and PostgresSQL? Do you wanna know some best practices about it? [more inside]
Features in Ruby I Miss While Working in Python
For a long time, I worked primarily on the Ruby on Rails stack. Recently, I moved back over to Python and Django. Both Ruby and Python are a joy for programming! They’re easy to learn and enable software developers to be productive very quickly. However, there are some features of Ruby I miss while working in Python. [more inside]
Using reCAPTCHA v3 with Turbolinks
reCAPTCHA v3 will stop working after a Turbolinks navigation. This implementation works by using the API’s explicit render (for the badge) and data-turbolinks-permanent to keep it on navigation. read more
Rubanok: parameters-based transformation DSL
Rubanok is tool built to slim down typical REST controllers index actions: it takes query params and apply the required transformations to the provided data (e.g. Active Record relation) via mapping classes (planes). [more inside]
3 Unexpected Behaviors using Ruby
READ THE POST — In Ruby, what I call an unexpected behavior is a behavior that doesn’t seem natural at first. [more inside]
What makes a great software engineer, great
Today I woke up wanting to start a discussion about what it takes to be an awesome software engineer. I constantly see recruiters evaluating candidates solely based on their programming skills. Hence, most developers focus only on learning the latest programming language out there. Is that all it takes? Here’s my two cents on the matter. [more inside]
RFS: Attr Reader, Writer and Accessor [free video]
In ruby a lot can be achieved in a single line of code. Defining our own getters and setters is usually done when we need custom behavior for all other cases there is already something built in ruby. We’ll cover attr_reader, attr_writer and attr_accessor in this post.
Tracking Email Open in Rails
How do you know if the email you sent was opened or not? A simple solution on Tracking Email Open in Rails
Exporting and Importing large amount of data in Rails
In this TIL note I will show you few ways how to export / import large quantity of data between two applications (e.g. old version to new version of the app) [more inside]
Fail Better: Turning Software Errors into Documentation
The open-source community has done a great job of promoting good documentation as a necessary trait for the success of a software project, whether it be a utility library, a larger framework or a standalone program. In my latest article I explain how we can take it one step further and also use error messages to educate our users.
Invalidating caches when using many-to-many associations in Rails
Implementing various methods of caching in Rails is relatively simple, and in most basic cases Rails handles cache invalidation out of the box or with minimal code. But when using many-to-many associations, propagating changes in one object to all its associated objects needs some setting up so that Rails can handle cache invalidation. In “Invalidating caches when using many-to-many associations in Rails,” I talk about various methods of achieving this, and why one should choose one over the other.
Run.rb (Ruby 2.6 compiled to WebAssembly)
My friend Will Glynn and I worked on a project recently that allows you to type out and execute Ruby code without ever leaving the browser. It’s Ruby 2.6.0 compiled to WebAssembly! We call it run.rb and pronounce it “runner bee.” Our next goal is to add the standard library to the website. Please give it a spin and let us know what you think! I wrote up a quick explanation of why I wanted to build it here. I’d love any ideas of how we can make it better. ❤️
Testing Rake tasks.
Some developers argue on the real value of testing Rake tasks since they’re only used once or on rare particular occasions. Others think it’s enough to extract all the logic out of them to properly tested objects (we’ll look into that later). Before fully diving into the question of how to test them (and if it’s really worth it), we’ll take a quick look at Rake tasks themselves. [more inside]
LIT Rails Internationalization (i18n) - the new way of translating Rails apps
Introducing - Lit 1.0: A reworked i18n Ruby gem that will make your web app’s translation a lot easier.
Ruby on Rails 6.0 Beta 1 Deprecations
A list of the deprecations that are listed in the CHANGELOG.md of the Ruby on Rails 6.0Beta1 release.