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.
GoF design patterns in Ruby
In this repo I wrote a summary of the design patterns explained in the book Design Patterns in Ruby, where Russ Olsen explains and adapts to Ruby 14 of the original 23 GoF patterns.
ActiveHashRelation reaches 1.4.0 with many new features.
ActiveHashRelation, a gem that allows you to run queries from an API that uses only Hashes, reached version 1.4.0. From Version 1.0 there have been many improvements and extended test coverage. Many features have been merged in the past 2 months, among others:
jQuery Tag-it - Integration with rails
jQuery tag-it is an excellent jQuery UI plugin with auto-complete support. This blog explains steps to integrate it easily with a rails app! [more inside]
Learn how to DRY out your RSpec tests with Shared Examples
Checkout my latest article where I explain How to use shared examples to DRY out test suit and bring consistent structure for designing APIs: How to DRY out your RSpec Tests using Shared Examples. [more inside]
Pronto v0.8.0 released!
Pronto keeps getting better at providing a quick automated code review of your changes. Check out the CHANGELOG for the list of features/changes/fixes of this release.
Setting Up Jenkins on Ubuntu 16.04 for Ruby on Rails CI
If you’re looking to set up a CI server using Jenkins to run Rails tests, here’s a quick how-to for setting up a Digital Ocean droplet with Jenkins: http://nithinbekal.com/posts/jenkins-rails/
Scalar: a thin, performant library for measurements
How thin? It is 168 loc. How performant? Check out the benchmark on Github. [more inside]
Autocomplete Using Redis (Basic)
Usually, when we implement suggestions in autocomplete input fields, we query directly to our database. Relatively, LIKE queries in MySQL are slower. So why not autocomplete using Redis? http://blog.katpadi.ph/autocomplete-with-redis/
A safer Pry prompt for the Rails console
A quick way to make your everyday work with Ruby on Rails a bit more safe with an improved rails console prompt. http://phansch.net/2017/02/12/a-better-pry-prompt-for-rails-console
Giving super powers to Rails nested forms with Vue.js — Part 2
Finished my quest in giving super power to Rails nested forms with Vue.js! All bugs smashed \o/ https://medium.com/@kdiogenes/giving-super-powers-to-rails-nested-forms-with-vue-js-part-2-acee4a3ee43d#.q8hzslmw3
How to dynamically add attributes to your ActiveRecord models
Sometimes we need to build an application that has domain models that we don’t know all the attributes of. A good example of such application is a system for tracking business contacts. In the center of it is a Contact model that has attributes like name, email, phone number, etc. But can we know beforehand all the attributes that our Contact model will need to have? If we want to create the application for a wide audience, it can be difficult to predict. Solution? Allow users to add more attributes to Contact model in the runtime! We’ll do exactly that in this tutorial. [more inside]
Store different kind of actions in one table
Store different kind of actions (Like, Follow, Star, Block …) in one table via ActiveRecord Polymorphic Association. ActionStore
Decorators, are we really decorating well? or using a tooth brush to paint a room?
After a little interest in my latest gem, I wrote a little piece to add to the design patterns in Rails conversation. A small blog about decorators in Rails and why I steer well clear of draper and other implementations. As well as an introduction to my own implementation of the decorator pattern, bottled_decorators.
Bringing more life to the irb
If you want to bring more life to your irb console then have a look at this. Irb can be made to do more things that you originally imagined. http://blog.redpanthers.co/ruby-irb-console-improvements-irbtools/
A better way to import all your records using ActiveRecord Import!
Ever suffered through importing lots of records using ActiveRecord ? If so, this post is for you! https://revs.runtime-revolution.com/a-better-way-to-import-all-your-records-using-activerecord-import-6053e20692f3#.n9lc1iwk5
An alternative to Rails before_action
Thoughts on best practices for filters in Rails controllers and the search for an alternative to the not proper uses of before_action. https://medium.com/@shvetsovdm/an-alternative-to-rails-before-action-eb010c3ffbfb#.9unc7tr7g
Integrate Rubocop gem with Popular (Ruby) Text Editors
Integrate rubocop(A Ruby static code analyzer) in popular text editors Sublime, Atom, Vim, Visual Studio Code and RubyMine [more inside]
Testing multithreaded ActiveRecord code with transactional fixtures
ar multi threaded transactional tests gem synchronizes transactions and db queries, so testing multithreaded code works with transactional fixtures.
Distinct Active Records in has_many through associations
A quick reminder on how to load only distinct collections into Ruby on Rails models with has_many through associations.
Introducing our Sidekiq cluster script
Here’s an easy way to run multiple Sidekiq processes via systemd: http://blog.honeybadger.io/introducing-our-sidekiq-cluster-script/
Animated Turtle Graphics using PDF
After seeing one of Jamis Buck’s weekly programming challenges being the implementation of a turtle graphics system, I decided to tackle this one using HexaPDF as backend. It turns out that animated turtle graphics are still more fun!
A Simple Introduction to Structs
http://www.rubyletter.com/blog/2017/02/03/struct-use.html An introduction to Ruby structs, their abilities, and when to avoid them.
How To Test Ruby CLI: Console
Learn how to programmatically interact with a child process (an IRB console) from Ruby. This is how I test Hanami CLI. http://lucaguidi.com/2017/02/08/how-to-test-ruby-cli-console/
A Medium editor for Rails
Hey, I’ve released a new version of Dante2, a Medium wysiwyg clone, which supports a better Rails integration and es6 module support check it out on https://michelson.github.io/dante2/
Handling exceptions in Rails' test environment like in production
Recently I encountered a difference between running Rails in production and test environment, and how you can fix it: https://christoph.luppri.ch/articles/2017/02/07/handling-exceptions-in-rails-test-environment-like-in-production/