Let's make Twirp and Protobufs easier with Ruby
We love Protobufs and Twirp, but what if we could make them even easier for Rubyists?
Job Queues
I got talking yesterday about async jobs in Rails and thought I’d put my thoughts on the blog too.
Collapsing old Rails Migrations
I don’t like deleting old migrations in my Rails apps, but if I did, here’s how I’d do it,
Coming Out of My Shell at RailsConf2017
I’m rather new to the world of software development. It’s something I truly enjoy and continue to dig deeper into. Just recently I had the opportuity to go to my first software conference, which was RailsConf 2017. Here’s my experience.
RailsConf 2017: An Organizer's Perspective
As a conference organizer, the experience can be a bit different. Find out why in this post.
Team Tools Roundup
Our distributed team uses some really interesting tools to do the work we do. Check out our tool roundup to find some new tools to try yourself.
Conferencing Success
Conferences can be overwhelming. Use these tips to make the most of your conference experience.
Here's Where Collective Idea Will Be Over the Next Few Months
We’re participating in or attending conferences and events all around the country. See when and if we’ll be in a city near you!
Guard is Your Friend
Test-driven development can be a little slow going, jumping between your code and your console, and targeting tests by line is prone to error. Use these tools and techniques to streamline your TDD.
Testing an Uploaded File in Rspec
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.
An in-depth look at two RailsConf tracks
RailsConf offers an opportunity to submit proposals directly related to specific tracks. Learn more about two of these tracks to get inspired and craft successful proposals.
Cropping Animated GIFs with MiniMagick
Cropping an animated GIF with crop
will continue to use the original image’s canvas size. This cool trick will ensure the cropped image ends up the correct size.
Getting Started with Action Cable
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.
Avoid parsing Rails controller params by using Metal
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.
Troubleshooting Feature Specs
Figuring out why your feature tests are failing can be difficult, especially when setting up the first few tests in the codebase.
Autocomplete your Rails Form using Selectize.js
When using Ruby on Rails Form Helpers, it could be useful to add an autocomplete feature to fields where users might reuse data. One way to do that is to use Selectize.js to create a dropdown and populate it with data from the user model.
Free SSL on Heroku
Starting today, Heroku has a new free SSL offering. Use it with Let’s Encrypt for a fully free SSL system.
Solutions to Potential Upgrade Problems in Rails 5
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.
How Rails Can Reduce Your Monthly Headaches
Months can be difficult to work with when they have a differing number of days. Rails helps out with #month, but you still need to use caution.
Modern Javascript and Rails
Want to write ES6 and/or use JSX or any of a vast array of modern Javascript tools in your Rails app? What about also writing your Javascript tests with the same tools? It’s easy with Browserify-rails and Teaspoon!
Painless Activity Streams in Rails
There’s a better way to implement business logic, and track events in Rails.
Let's Encrypt with a Rails app on Heroku
I needed to renew an SSL certificate today, so I used it as an excuse to try Let’s Encrypt for a free certificate for a Rails app hosted on Heroku.
Bi-Directional and Self-Referential Associations in Rails
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.
Quick Setup for Your Rails Apps
We need to make getting up and running with our Rails apps easier. Here’s my attempt.
How to Pluck Like a Rails Pro
The pluck method is a performant option to query columns from one or more tables. The ability to pass valid SQL directly makes it all the more handy.
Fixing Intermittent Failing Tests
Some tricks to help you fix tests that sometimes fail.
Bootstrap Your App
Insert your app’s bootstrapping into CI to ensure that setting up a new developer is one script invocation.
Streaming Data From Postgresland to Rubyland
I recently gave a talk covering find\_each
, pluck
, and the PostgreSQL Cursor gem for the West Michigan Ruby Users Group.
Optimizing Rails for Memory Usage Part 4: Lazy JSON Generation and Final Thoughts
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.
Optimizing Rails for Memory Usage Part 3: Pluck and Database Laziness
Some ways to reduce memory usage as you gather records out of your database into Rubyland.
Optimizing Rails for Memory Usage Part 1: Before You Optimize
Part one of a four-part series which will show you how to optimize a memory-heavy Rails API action.
Optimizing Rails for Memory Usage Part 2: Tuning the GC
Changing Ruby’s garbage collection parameters is the least invasive way to optimize your app’s memory usage.
Non-Message Flash in Rails
Flash messages were one of those little features that amazed me when I was first introduced to Rails. Developers often use Rails’ flash to display messages to their users, but messages aren’t the only reason to use flash.
How we write a Gemfile
Tips on how we like to organize Gemfiles and keep it clean.
has_and_belongs_to_many Isn't Dead!
People are under the impression that HABTM relationships are deprecated because of the newer Has Many Through relationship. Both are good, and both have their place, but HABTM is still valid, vibrant, and useful!
Time to Bring Back Fixtures
Fixtures are great tools that have been sadly overlooked for a long time in the Rails world. Lets start using them again.
The Marriage of Figaro… and Rails
Two years ago and 264,309 downloads ago, I wrote the Figaro gem. I had been using the pattern for some time already and was frustrated that something so simple wasn’t already included in Rails. And now, finally, it is! Well… sort of.
Building Awesome Rails APIs: Part 1
After teaching an Advanced Rails class last week, I realized that we use a lot of patterns internally to build great APIs in Rails that many people don’t know about. We didn’t invent most of them, but we use them with great success, so we need to start sharing.
Where's Your Business Logic?
Can you point to a single place in your application and say “here is where we implement our business rules and use cases”, or are your use cases spread out across controllers, models, libs and elsewhere? Do you have fat models, fat controllers, and/or a massive lib directory? Is adding new features quick and easy or painful and time consuming? I have a solution to your pain.
Walken on Rails
Our new screencast series features narration by Christopher Walken.
Give pry a Try
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.
Capybara, Cucumber and How the Cookie Crumbles
I use Capybara and Cucumber to test my Rails apps, but cookie management can often be difficult… until now.
Changing Your Stripes
Using Stripe to take credit cards online.
Thinking about Ruby's Symbols
Symbols in Ruby are confusing to new users.
Use Chrome with Cucumber & Capybara
Swapping out Firefox for Chrome is easier than you think!
Rails 3.1 Hackfest this Saturday
There’s a Rails Hackfest this weekend and we are opening our doors to Rails devs who want to participate.
Automatic Login Links
Scary, I know, but hear me out. Implemented correctly, an automatic login link can be just the ticket to appease those pesky, forgetful, real-world users.
More User-centric Routes: Rails 2
Writing routes that are conditional upon whether a user is logged in is easy with Rails 3 but if you find yourself (as many of us do) stuck with a Rails 2 app, here’s how to achieve the same fancy routes without the latest Rails.
User-centric Routing in Rails 3
Have you ever noticed that the GitHub homepage is different once you log in? I’m not talking about little changes here and there. It’s a completely different page. I have no idea how GitHub does this but I’ll venture a guess and demonstrate how to achieve the same effect.
Testing with Sunspot and Cucumber
Testing with sunspot with cucumber can be tricky since you need to manage the solr process separately. This post introduces a new gem “sunspot_test” and how to easily use it.
Bundler makes contributing to ruby gems easier
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.
Using Solr and Sunspot to Search Within Words
In my previous post I mentioned that out of the box Solr breaks up the search indexes on whitespace. This post will outline how you can configure Solr to search within words.
Exploring Solr and Sunspot
We have experienced a lot of success using Solr and Sunspot for full text searching on our Rails projects. And like our Cucumber series, we’re going to start a series of related posts just on Sunspot/Solr.
Clever Custom Datatypes with MongoMapper
A whole world of rich objects is within your reach with MongoDB.
2010: The Open Source Tools that Made it Great
My list of open source tools that made a big impact on our work this year.
SSL with Rails
Lots of people have been wondering about SSL after seeing Firesheep in action. Here’s how to get started with Rails.