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.
Making sense of ActiveRecord joins, includes, preload, and eager_load
Like a pair of jumper cables, ActiveRecord’s joins
, includes
, preload
, and eager_load
methods are incredibly useful, but also very dangerous when used incorrectly. Knowing when and where to use each approach - and even when to combine them - can save you considerable trouble as your app grows.
Rendering Ember components from Rails
A nice guide on all the available ways to integrate Ember with Rails.
[Screencast] Random Ruby Tips and Tricks
A collection of different Ruby tips and tricks. Hope you find some of them useful! https://www.driftingruby.com/episodes/random-ruby-tips-and-tricks
ReadSource 0.2.4 released!
ReadSource is for reading method source code and now features support for inline methods, an attr?
checker, and the ability to open method source code directly into a VIM server instance without disturbing the current Ruby process. read_source
Elixir for Rubyists
On the surface, Elixir and Ruby share a similar syntax. This familiarity may at first hide the striking differences between the two languages. Read my gentle introduction for Ruby developers intrigued to learn more about Elixir. Discover the language, created by José Valim, that took the Erlang virtual machine (BEAM) and put a sensible face on it.
Small steps to DRYer RSpec
The blog post shows several tricks/code snippets for making your specs more DRY (and preferrably one-line). It mostly takes approaches of rspec/its
gem a bit further.
tty-file v0.2.0 release!
The new tty-file adds new powerful ways to work with directory contents by using methods such as create_directory and copy_directory. You can also easily create checksums for files and strings by calling checksum_file. Enjoy!
Using Docker For Development
I’ve written an article on using docker for development in Rails. This is part one of my Docker series.
Rails + Postgres Array + ANY LIKE
Ruby on Rails has a good support for Postgres Array type. I really like using this feature when creating a separate database table sounds like over-engineering. In this short post I want to share my solution for the following problem: “find a record for which any of its tags contains a given string”.
google_assistant gem can get user details
The google_assistant gem makes it easy to create Google Assistant actions in Ruby. It has hit v0.2, which brings the ability to request details about the user: their name, their zip code, and their precise location.
FXRuby Enhancement 0.1.0
I’ve added component reuseability and and easy way to deal with data-targets, and more. Oh, and there’s more documentation. https://github.com/flajann2/fxruby-enhancement/blob/master/README.org ‘Live’ example code can be found at: https://github.com/flajann2/rubyneat-panel/tree/master/lib/rubyneat-panel
How To Test Ruby CLI: The Setup
One of the most difficult tasks I met during Hanami development is to write integration tests for the Command Line Interface (CLI). This challenge required a deep knowledge of the Ruby toolchain. http://lucaguidi.com/2017/01/20/how-to-test-ruby-cli-the-setup/
Auto-reconnect for ActiveRecord connections
Custom auto-reconnect in Rails applications when using ActiveRecord connections.
Rescue exceptions DSL for plain Ruby objects with Rails
Likewise in Rails controllers we have a useful functionality to catch exceptions with rescue_from in order to change the default behavior, it’s too easy to obtain it for any other type of a Ruby object in Rails applications. Check out this post about the solution.
Decoradar – Simple and zero auto-magical decorator+serializer in Ruby
Decoradar is a simple and magic-free decorator+serializer that brings ActiveModel::Serializer/Draper DSL-style declaration to Plain Ruby Object. View more at https://github.com/huynhquancam/decoradar
Writing Sprockets plugin
In this blog post i show you how easy it is to write an Sprockets plugin for your Rails Asset Pipeline: http://masa331.github.io/2017/01/10/writing_sprockets_plugin.html
Limited-time promotion from Upcase and RubyTapas
Upcase and RubyTapas are joining forces to offer a time-limited discount on their services (and special add-ons like a live AMA). [more inside]
Ruby's Mysterious Triple Equals Operator, a.k.a. Case Equality Operator
You may have never used Ruby’s triple-equals operator. But understanding it is key to unlocking the hidden power of case
, rescue
and other Ruby features. http://www.rubyletter.com/blog/2017/01/18/ruby-triple-equals-operator.html
Bundler and Gemfile best practices
Taking care of your Gemfile with basic hygiene and some ongoing love will make life for future you much easier: Bundler and Gemfile best practices
New Podcast from Table XI and Noel Rappin
I think people here might be interested in a podcast I’m doing, http://www.techdoneright.io/ – it’s about building better software to develop better careers, companies, and communities. The first episode has Jessie Shternshus of The Improv Effect talking about building trust and building teams, with some great advice on making feedback work. I’d really appreciate it if you checked it out and passed it along — http://www.techdoneright.io/001-building-trust — I think you’ll like it.
Played around Redis Keyspace Notifications with Ruby
I came across the so-called Redis Keyspace Notifications and played around it with Ruby. It basically acts as a Pub/Sub mechanism that enables clients to subscribe to a Redis channel and receive “published” events whenever a Redis command or data alteration is encountered. [more inside]
Introduction: ChartKich for easy data visualization & protyping in Ruby
Charkick make visualization of data easier in a Ruby on Rails application. Its quite easy to work with to create charts to make business decisions. This article is about the introduction to the framework. http://blog.redpanthers.co/chartkick-data-visualization-easy-ruby/
Integration Testing Ruby on Rails with Minitest and Capybara
Capybara is an acceptance test framework for web applications. This tutorial explains how to use it with Minitest for integration testing of Ruby on Rails applications. https://semaphoreci.com/community/tutorials/integration-testing-ruby-on-rails-with-minitest-and-capybara
A cleaner way to set conditional CSS classes on 'link_to'
Using inspiration from React, there’s finally a more elegant way to set multiple conditional CSS classes on link_to
and other Rails tag helpers which take a :class
option. No more string interpolation and messy logic in the views. http://www.carlosramireziii.com/a-cleaner-way-to-set-multiple-conditional-css-classes-for-link-to.html