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.
Removing the @ Hack in Rails Controllers
Wrote up a quick article explaining a technique I have found used for loading data in controllers in a way that I find more maintainable then before_action hooks. Interested in feedback.
MiniTest + swagger = MiniApivore
API testing rails-free gem for swagger documented APIs: https://github.com/alekseyl/mini-apivore [more inside]
My Favorite Ruby Community Resources
Following a conversation with a fellow developer, I decided to expand a private message into a full post https://schwad.github.io/ruby/rails/community/resources/2018/05/03/my-favorite-ruby-community-resources.html
[Screencast] User Notifications
Using the Notifications Rails Engine, we are able to add notifications to our applications based on certain events. The engine provides the schema and necessary controls and associations to seamlessly integrate into your app. https://www.driftingruby.com/episodes/user-notifications
Setup ELK for NGINX logs with Elasticsearch, Logstash, and Kibana
ELK Elastic stack is a popular open-source solution for analyzing weblogs. In this blog post, I describe how to setup Elasticsearch, Logstash and Kibana on a barebones VPS to analyze NGINX access logs. I don’t dwell on details but instead focus on things you need to get up and running with ELK-powered log analysis quickly. [more inside]
Deep Learning with Apache MXNet and Ruby
Insights on using Apache MXNet by Kenta Murata with Ruby in a RubyKaigi presentation: https://speakerdeck.com/mrkn/deep-learning-programming-on-ruby [more inside]
Introducing highlightjs-turbolinks, a turbolinks 5 compatible fork of highlight.js
Highlightjs-turbolinks is a Turbolinks 5 compatible fork of Highlight.js, and is up to date with v9.12.0. [more inside]
Http.rb is Great
Http.rb is a very nice HTTP client gem with impressive features. In this article I talk about some of http.rb’s capabilities that make it stand out for me, and compare them with Net::HTTP.
Dynamically setting default_url_options in Capybara
If you’re developing a full-stack Rails app with a link-based hypermedia API then you may find incorrect URLs breaking your system/feature Capybara specs. Find out what’s going on and how to fix it by dynamically setting default_url_options in Capybara.
teletype - create command line apps the easy way!
tty now includes the teletype executable for scaffolding command line applications. Generating new application is a simple as running the teletype new my-app-name in your console. You can then add new commands and subcommands with integration and unit tests baked in. Let me know about your terminal creations built with teletype! Everything you need to know is in a readme document.
last mile and Gemfile.lock
If you are responsible for an application, a last-mile application, not a library (a gem), please check in your Gemfile.lock. Updating your dependency gem versions is something you do deliberately, under the cover of your test suite.
How to Speed Up Your Tests via :build_stubbed
Learn how to speed up your test suite using build_stubbed. This approach works well when you test models or services. [more inside]
Is Your Rails Team Slowing Down? Here's Why, And What You Can Do About It
Do any of these statements resonate? [more inside]
Ruby ♡ Unicode
What is a character in Unicode? What are, and how to use the Unicode case-mapping and normalization algorithms in Ruby? How to detect emoji in text? What is the difference between invalid codepoints and non-characters? Answers to all those questions might be found in Idiosyncratic Ruby Episode 66: Ruby has Character
Simple, Async, Map/Reduce queue for Ruby
How DNSimple implemented parallel requests in near real-time with a simple Ruby queue. https://blog.dnsimple.com/2018/05/simple-async-map-reduce-queue-for-ruby
Setting up a BDD Stack on a Rails 5 Application
An excerpt from Rails Testing Handbook, this post shows how to practically get started with behavior-driven development (BDD). We generate a new Rails 5 application with all the necessary tools, including RSpec and Cucumber, and get to the first green CI build. Read tutorial →
JsonschemaSerializer: turn your ActiveRecord models into json schemas
Have you ever considered to serialize your ActiveRecord models into valid jsonschema? You can get easily and for free thanks to this gem for jsonschema serialization. The first stable release of jsonschema_serializer is out and I would love to receive your feedback, feature or pull requests!
Why Do We Use Nil?
In this article we explore why do we use nil, the problems with nil & type checking, and what to do about it. https://www.rubyguides.com/2018/05/why-do-we-use-nil/
An Open Source Data Dictionary for Cities in RoR5 + React
As Cities start working through the ‘What Works Cities’ program, you quickly come upon the requirement to build a ‘data dictionary’. Looking around, everything looked like some variation of a spreadsheet, but I wanted to something that would help visualize and surface the data relationship between our myriad applications. [more inside]
Arel with Wharel
Wharel is a tiny little gem that uses the empty room pattern to make Arel queries easier to build. In this blog post, I walk through all 31 lines of this tiny gem and the features of Ruby’s object model that make it so simple and powerful.