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.
Rails ActiveStorage is automatically storing width/height of image
When reading ActiveStorage Overview Guild chances are you missed section on #analyze which claims: [more inside]
Continuous Deployment to Heroku with Rails & GitHub Actions
GitHub Actions works great for running Continuous Integration and Continuous Deployment (CI/CD). Watch the Continuous Deployment with Rails & GitHub Actions screencast.
season-formats gem - read / parse and print seasons (e.g. 2020/21)
Hello, I have put together (extracted really) a little helper class
for seasons and bundled up in the season-formats gem / library
for easy (re)use that lets you read / parse and print seasons (using an academic e.g. 2020/21 or calendar year e.g. 2020). Cheers. Prost. PS: Bonus, yes you can use the new Season class with ruby’s built-in ranges too e.g. Season( '2010/11' )..Season( '2020/21' )
Manage ranges and overlaps with ease by using multi_range
multi_range allows you to manipulate a group of ranges. Such as merging overlapping ranges, doing ranges union, intersection, difference, and so on.
A short deep dive on Symbol#to_proc
In this article we explore what happens with the “ampersand, symbol” syntax and how the result differs from “regular” blocks [more inside]
Ruby Advent Calendar 2020 - 25 Days of Ruby Gems / Libraries - Have Your Say!
Hello, I’m trying a new edition of the Ruby Advent Calendar this year in 2020 - 25 Days of Ruby Gems / Libraries from December 1st to December 25th. Starting in 10 Days. Have your say! Claim A Free Day. Cheers. Prost.
Unofficial guide to Tailwind and ActionText for Rails 6
I recently wrote an article on how to install ActionText using the latest Rails 6, also it guides you through the workarounds of using it with Tailwind. [more inside]
Where Do Ruby Blocks Come From?
It’s time to get reflective…time for some deep introspection…so light a candle or two, put some Barry White on the stereo, get nice and comfortable, because we’re going to talk about Blocks. Blocks in Ruby are powerful, and they’re used everywhere. But we’re not here to talk about how to write blocks per se or what they’re good for. We’re here to talk about where they come from.
Fun with Ruby method argument defaults
A quick overview of simple but powerful (if weird) techniques of (ab)using Ruby method argument defaults, like def read_data(file: raise(ArgumentError, '#read_data requires path to .txt'))
Adding Authentication in Rails 6 with Rodauth
Tutorial on adding authentication to a Rails 6 app using the Rodauth authentication framework: https://janko.io/adding-authentication-in-rails-with-rodauth/
RailsBump
Hello folks, I’m happy to present RailsBump, which I have been working on for a while! RailsBump is useful to anyone looking to upgrade the Rails version of their app. It shows you whether your favorite gem (or all gems in your Gemfile) is compatible with the next Rails release. Check it out and let me know what you think: https://railsbump.org/ If you have ideas for more features or run into problems, please open a Github issue: https://github.com/manuelmeurer/railsbump
Generating PDFs In Rails Application Using DocRaptor
I wrote about how to generate PDFs using DocRaptor.com in Rails 6 at https://bilalbudhani.com/generating-pdfs-in-rails-application-using-docraptor/
My Beef With RuboCop
My aim here is to disabuse readers of the notion that RuboCop can only make code better. It’s a tool, and whether it helps or hurts depends on how it’s used. Don’t be afraid to disable cops if you can’t see how they benefit the team. https://www.rubypigeon.com/posts/my-beef-with-rubocop/
Ruby Refinements Have a Second Good Use Case
After conversion wrappers a second good use case has been discovered in the development of a configurable logger for StimulusReflex: Refinement of String in our Gem to provide a nicer API to color your output without polluting the class for the whole application:
https://dev.to/rolandstuder/ruby-refinements-have-a-second-good-use-case-42jk
Exploring Merge Sort With Ruby
You’ll probably never implement sorting from scratch. But sorting algorithms are foundational in computer science and have become a standard feature of the ritual hazing…er…interview process for developers at all levels. In this article, Julie Kent introduces us to the merge sort algorithm. She’ll show us how it works, implement it in ruby, and discuss its performance characteristics. [more inside]
Overriding private methods of superclass in Ruby
What happens when a private method of superclass is overridden in Ruby? https://medium.com/rubycademy/overriding-private-superclass-methods-in-ruby-82ee4789c8f2
acts_as_tenant v0.5.0 released by excid3
Multi-tenancy is Rails is very common but we didn’t have an actively maintained gem. Chris Oliver just become the maintainer of Acts_As_Tenant and published a release https://github.com/ErwinM/acts_as_tenant/releases/tag/v0.5.0
Rails Model Patterns and Anti-patterns
If you’re struggling with models, this blog post is for you. We will quickly go through the process of putting your models on a diet and finish strongly with some things to avoid when writing migrations. [more inside]