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.
WhereChain extension gem
Stop writing Post.where('comments > ?', 10), write Post.where.gt(comments: 10) instead! GitHub repository [more inside]
Rails ActiveRecord SQL queries log beautifier
Works with pure Ruby 2.2+ and with Rails 4.0+ [more inside]
The Comparable mixin
The Comparable mixin is part of the Ruby core. It’s used by classes that can be compared. [more inside]
How to Deploy Rails Applications With Ansible, Capistrano and Semaphore
I wrote a tutorial on how to use Ansible to orchestrate a server, deploy a Rails application to it with Capistrano, and set up continuous integration with Semaphore. [more inside]
The Definitive Guide To Time Complexity For Ruby Developers
Time complexity is one of the most interesting concepts you can learn from computer science. Read the full article: http://www.rubyguides.com/2018/03/time-complexity-for-ruby-developers/
Elapsed time with Ruby, the right way
Elapsed time calculations based on Time.now are wrong. Learn why they are wrong and how to fix them. https://blog.dnsimple.com/2018/03/elapsed-time-with-ruby-the-right-way/
Passenger 5.2.2 released: passenger_base_uri fixed + NEW Phusion product spoiler
Passenger 5.2.2 was released, fixing a passenger_base_uri regression, adding internal tooling AND hinting a new & free Phusion product to be launched very soon: https://blog.phusion.nl/2018/03/28/passenger-5-2-2/
Capistrano deploy to ubuntu with systemd, nginx/puma and rbenv
This tutorial will show you how to deploy a Rails app via Capistrano, run it with Puma, restart it without sudo access and be able to host multiple environments and apps on same server: [more inside]
Exotic Ruby: Module.class_exec, Custom JSON and Liquid Drops in Action
Ruby has quite a lot of “exotic” features that are not used that often, but when you need to utilize some metaprogramming magic, you can easily take advantage of them. One of such features is Object.instance_exec which you might be familiar with if you’ve ever built some more advanced DSL. [more inside]
Final Week for the 2018 Rails Community Survey!
The 2018 Ruby on Rails survey closes this week! If you’re a company-side product developer or freelancer that works in Ruby on Rails, I’d love if you took 5 minutes to complete the biggest survey of the Rails community. All the survey data is public! [more inside]
How to create your own Rails 5.2+ Active Storage Previewers
ActiveStorage only comes with the ability to preview PDF and video files, but what if we want to support other file types? Check out how to create an Active Storage Previewer where we’ll use Powerpoint presentations as our example file type.
Metaprogramming: Ruby Hook Methods
Ruby comes with a bunch of hook methods that allow you to manipulate classes, modules and objects on the fly.. see more
How to use Rails Webpacker with NPM instead of Yarn
Webpacker is an awesome tool but it comes with Yarn. If you prefer to use NPM here is a guide how to use it with webpacker.
4 cool but less popular Rails features – part 1: ActiveJob, ActiveModel, command line
I never read the whole Rails guides and now when I’m translating them to my native language I discovered some cool features that I didn’t know about before. I hope this will be also useful for you! READ MORE
fugit 1.1.0 released
fugit is library for parsing cron, duration, and at time strings. It will be used by future version of rufus-scheduler. fugit 1.1.0 has been released. It now understands cron strings with time zones, like “0 0 * * sun Europe/Berlin” (every sunday at 00:00, Berlin time).
Ruby benchmarking basics and example case
As folks work towards a faster performance with Ruby 3X3 I dig a bit deeper into Ruby Benchmarking showing the basics, and diving into a specific example case.
base32-kai - New CryptoCollectibles Gem - 5-Bit Kai Notation/Alphabet Encoding
Hello, do you have (crypto) collectibles on the blockchain? Encode / decode your binary bits in 5-bit groups in the base32 / kai notation with the new base32-kai library /gem. What’s it for!? Use it for (crypto) kitties, copycats, and friends. Happy collecting and encoding / decoding bits & bytes. Cheers. Prost.
Private & Protected: a matter of Message
As a Ruby method is, behind the scene, a message handler associated with a block of instructions that returns an object, the private and protected policies are strongly correlated with the Ruby message concept.. see more
More yield_self awesomeness
The second yield_self-praising blogpost investigates some approaches to code that the new method brings. And also proposes better name for the method :)
Code editors for Mac
I am currently developing with Ruby on Rails, and my favorite editor is TextMate 2. In this article, I will explain my reasons for this by comparing it with other well-known editors: Sublime Text 3, Atom, Visual Studio Code and Brackets. https://medium.com/@davidmles/code-editors-for-mac-747fe90334d
Method Driven Development with the new 'interesting_methods' gem
I’ve created a new gem called interesting_methods that gemifies what some developers already do (add an interesting_methods method to all their objects).
http://smallcity.ca/2018/03/23/interesting-methods-gem.html [more inside]
webpacker & less & Semantic UI Theming
Some copy&paste instructions on how to make less and semantic ui theming work nicely with webpacker.
Bitcat - Bit catalog browser for digital bit(s) collections eg (crypto) kitties etc.
Hello, I’ve put together - bitcat - a little sinatra web app / server in ruby packaged up as a command line tool that lets you browse your digital bits(s) eg. crypto kitties and friends unchained (offline) using a single-file SQLite database eg. kitties.db. Note: Bitcat includes the gene reader from copycats in base32/kai notation and more. Happy collecting. Cheers.
RVM Gemset as a Freelancer
As a Ruby on Rails Freelancer since few years now, I have been worked in a bunch of projects. For each mission, the environment setup is very important as I’ve to be efficient quickly. This is where RVM Gemsets are important.. see more