Sometime you need to test how your code handles an uploaded file, but you don’t want to upload it in your test. Luckily, there’s an easy way to handle this.
With the inclusion of Action Cable in Rails 5, we can easily add WebSockets to our Rails applications. This post walks through how to set up Action Cable as a response to an action on an Active Record model.
While looking at a controller today, I came to the conclusion it’s better to use
ActionController:API instead of
ActionController::Metal. Here’s why.
I’ve been using and teaching Ruby for many years now, but I recently had an epiphany about private methods.
The Rails 5 upgrade has a few changes that may cause confusion. We look at how to get around the disabling of autoloading and look at the new deprecation warnings.
Middleman was built by Thomas Reynolds over eight years ago as a way to build static sites with easy-to-use framework. I talk with Mr. Reynolds about a few new features for Version 4 of the tool.
How can our test suite tell us when a certificate expires? We’ll show you.
I’ve been working on an application that works to match users together based on a complex set of criteria (read: big slow database query and in-memory processing). The core usage of the application revolves around these user matches, so I want to make sure that either the algorithm will run very fast or can be cached so that it’s not run every time a user visits their matches page.
The most important requirement for our matches is reciprocation. To solve this problem and meet all of the requirements, we can create a bi-directional, self-referential, self-syncing, many-to-many association between users using a
has_many :through association with a join model to keep track of a user’s matches.
We need to make getting up and running with our Rails apps easier. Here’s my attempt.
Some tricks to help you fix tests that sometimes fail.
Need to round to the nearest 30 minutes or up to the next 250 or some other fun rounding case? Ruby’s build-in
ceil won’t help you, but the Rounding gem will.
Insert your app’s bootstrapping into CI to ensure that setting up a new developer is one script invocation.
I recently gave a talk covering
pluck, and the PostgreSQL Cursor gem for the West Michigan Ruby Users Group.
Code to copy-paste so you can lazily serialize JSON and maybe even stream it to the client, and an argument for why we shouldn’t have to do any of this.
Some ways to reduce memory usage as you gather records out of your database into Rubyland.
Part one of a four-part series which will show you how to optimize a memory-heavy Rails API action.
Changing Ruby’s garbage collection parameters is the least invasive way to optimize your app’s memory usage.
How do you test a slow file upload? Force it to be slow.
I want to make Ruby better by making it smaller. Who wants to help?
Tips on how we like to organize Gemfiles and keep it clean.
By default, Ruby only rescues subclasses of StandardError to allow the really bad stuff to halt your program.
If ruby is segmentation faulting on Travis CI, try updating libxml
I love designing and building APIs. Usually those APIs are in the form of REST web services. A lot of care goes into the interface of a web service because it’s how your application is presented to the outside world. But what about the interfaces of your internal code?
Recently one of our projects called for using the browser’s Geolocation API. We were excited about this project. However, we had an immediate concern about how to test a feature that interacts with one of the browser’s built in APIs.
Many users are having OpenSSL validation issues with Ruby 2.0 across various platforms. Turns out there are multiple issues at hand, each requiring different fixes.
How Google’s perftools led me to add a single line of code that cut test suite run times in half.
We had way too much fun with Ruby and Unicode, and the result is that you can now join in the fun with our unicode_math gem.
Last week HipByte released RubyMotion and although I was originally skeptical, I’ve grown to really like it.
Our new screencast series features narration by Christopher Walken.
One of the things holding us back from developing on Ruby 1.9.3 has been ruby-debug. So after many people suggested we try it, we gave pry a shot. I don’t know why we didn’t before; it is quick, easy, and allows a wide range of Ruby versions.
Get Ruby 1.9.3-p0 installed with libyaml on CentOS to avoid warnings.
Symbols in Ruby are confusing to new users.
A quick introduction to Class.allocate, a class method you can use to allocate space for a new object and skip initialization of that object.
I have read several opinions that are either pro-Bundler or pro-RVM, but despite the current debate they do not have to be mutually exclusive.
There’s a Rails Hackfest this weekend and we are opening our doors to Rails devs who want to participate.
I’m going to be speaking and teaching at Lonestar RubyConf this year. Look us up if you’re attending.
In the world of Ruby’s conditional assignment operators,
||= is Alec Baldwin; charming and versatile. But not many people know about
||=’s little brother… the
After using Bundler for the past few months, I love it. It turns managing project dependencies and deployment into a piece of cake. However after coming across a particular dependency declaration, something clicked in my head that made me like it even more.
A whole world of rich objects is within your reach with MongoDB.
My list of open source tools that made a big impact on our work this year.