rails
68 posts · All topics
- — Handling of HTTP Headers in Grape with Rack and Rails
I recently helped debug Grape#1880, an issue a developer had with HTTP headers in Grape and Rack. It wasn’t immediately obvious.
- — Wiring Up a React Native Client to a Rails GraphQL Server
In the previous post I added a React Native ticking timer. I now have enough client-side parts and it’s time to wire up the client app to a server. This cookbook should be helpf...
- — Building and Consuming a GraphQL API with Ruby on Rails
In the past few weeks I’ve convinced myself that GraphQL can work well for any micro-service. This post is a full walk-through of getting a working GraphQL API on Ruby on Rails....
- — Writing a Slack Bot running on Rails (with React)
I cooked up a little demo of a Slack bot running on Rails with React, that displays messages that you send to Slack, on a web page.
- — ActionMailer Integration Testing with Email-Example-Spec
Introducing email-example-spec, integration testing for your ActionMailer e-mails.
- — Syntax Highlighting in Markdown Content with Recarpet, Coderay and Rails
I wanted Ruby and JSON code blocks ala Github’s Flavored Markdown when rendering markdown documents in doppler. The idea is that we can API documentation authored in markdown, a...
- — Precompiling Rails Assets before RSpec/Capybara Integration Tests
The first Capybara integration test always tends to timeout when compiling assets on-demand. It’s just damn too slow. Precompile your assets before the test is run.
- — New York Times Open Source Science Fair
- — How Long Does it Take to Create a 12 Lecture, 8 Week Course
My family counts many teachers. My grandparents were teachers, my father started as a school English teacher and is now a University professor. My wife changed her successful ca...
- — Crafting a Ruby on Rails Course for Developers
- — How to Redirect Bang Hash Urls
Sometimes you send many e-mails with an important URL having the bang first. No big deal. Read about it how to redirect it on the Art.sy Engineering blog.
- — Github Hacked: Things to Do on Monday
You should take a serious look at your application and write some tests, first thing Monday.
- — Watching Rack Application Changes with Guard-Rack
One of the frequently requested features in Grape is to automatically reload code changes, much like Rails does (#131). This is actually pretty difficult to implement and requir...
- — Updating Devise Trackable Last User Sign-In Time with Devise Rememberable
Devise has a :trackable _strategy which updates the user’s last sign-in time, remote IP and increments a counter in the _User model upon successful logon. This is implemented in...
- — CarrierWave: DelayJob-Processing of Selected Versions, Revisited
I’ve written about delay-processing certain image versions in this article. We’ve made some progress since with a much more robust implementation. Check out this new post on the...
- — Testing w/ Analytical Gem and RSpec
We use the Analytical gem to include various thirdparty Javascript in our Rails application. Our test environment was configured with dummy values in config/analytical.yml.
- — Warning: Toplevel Constant XYZ Referenced Admin:XYZ
I posted this to a Ruby forum a while ago.
- — Fabricating Spec Failures
I love fabricators. We use the awesome fabrication gem that lets you do some pretty neat things in Rails specs.
- — Grape vs. Webmachine
One of my favorite talks at QCon 2011 was about Webmachine. I was very curious to see what those well-disciplined Erlang people had come up with. At the end of the talk I had le...
- — Grape: Describing and Documenting an API
Building a software platform is not just an investment in the future, it’s a software architecture philosophy. A proper API is a manifestation of some of the core principles of ...
- — Pushing Assets to S3 w/ Rake: Versioning and Cache Expiration
A while ago I wrote about how we package and push Rails assets to Amazon S3. We version assets with the GIT hash – varying the assets by URL enables setting indefinite cache exp...
- — Serving Compressed Rails Assets from S3 via CloudFront
I wrote about how we do asset packaging with Rails, how we Jammit and push them to S3 in this post. We’ve had a few surprises since then, one that had to do with compressed asse...
- — NYC.rb: Building RESTful APIs w/ Grape
I’m speaking at NYC.rb tonight @ Pivotal Labs, RSVP.
- — Rendering Markdown Documents in Rails
There’s got to be a prettier way of implementing this.
- — Grape: Routing Multiple Methods
Sometimes you want to support both GET and POST in a Grape API.
- — Filtering by User-Agent in Rails
Let’s filter out some unwanted browsers from displaying broken pages in our Rails application. We could disallow IE6, for example, but allow IE7, 8 and 9.
- — NoRails: Application Design in Times of APIs
A recent post “Rails is Not Your Application” caught my attention. It was fundamentally right, but the suggested implementation was misguided.
- — Sorting Tables in Rails w/ Mongoid
Sorting tables in Rails is a common problem. It must have been done before, right? In fact it has been done so many times that it’s really hard to find anything that “just works...
- — Capybara: Failed to Resynchronize, Ajax Request Timed Out (not caused by green elves)
I used to attribute this error to little green elves inside of Capybara, Selenium or Firefox. But, as usual, things turn out to have a much more reasonable explanation.
- — CarrierWave: DelayJob-Processing of Selected Versions
Our image upload pipeline has gotten a bit too long and no longer fits in the Heroku’s 30-second limit. We generate several image versions and would like to get a couple of size...
- — New Relic: Performance Instrumentation with Grape API
We’re using Grape in our Rails app on Heroku, which comes with New Relic instrumentation out-of-the-box. Let’s get the Grape API route details to show in New Relic as well.
- — Rails Editable Mail Templates w/Preview from 37Signals
Last time we added custom editable mail templates to our mailers and made them Markdown format [read first]. Awesome. Let’s add a preview to the templates with 37-signals mail_v...
- — IE9: Cache-Busting with Grape Middleware
Ran into a series of weird bugs with IE9. Turned out that a lot of our API requests were cached on the client. I am not sure whether this is some clever plot to make things work...
- — Rails: Custom and Editable Mailer Templates in Markdown
You love markdown? We do too.
- — Exporting Data to Excel in Ruby on Rails w/ Spreadsheet and to_xls
- — Permission denied - /var/tmp/ruby-uuid
I’ve been fighting a trivial RoR controller test failure on a new build machine. The spec is rather trivial.
- — Embedding API Sandboxes in Documentation
Oh, I know how much you want this!
- — RSpec: Fuubar + Breaking Tests into Suites
Inspired by this post on RSpec best practices and updated for RSpec2.
- — Selecting items from a dropdown with Capybara, Selenium (Firefox) & JQuery
I am having a weird problem with Capybara and Selenium (Firefox) selecting items in a dropdown.
- — Modularizing a RoR Grape API: Multiple Versions
We made some progress with modularizing our Grape API in the last post. But we only had one version and declared Api_v1 as our main API entry. Unless you’re Netflix and need an ...
- — Introducing Gem-Licenses: Collect 3rd Party Licenses in RoR Projects
Yet again I have to deal with 3rd party licenses, this time in RoR. It’s a pretty common thing to do for technical managers and in my last job I ended up creating 3licenses. For...
- — Modularizing a RoR Grape API
A lot of people ask me whether we use Rails controllers for our API. We don’t, we use Grape. Grape is a Rack-based system and a DSL that provides a cleaner separation, some API-...
- — Mongoid 2.0.2 Dropped Pagination => Kaminari
I was a bit surprised to see mongoid drop pagination support in 2.0.2 (here and here). It got some people confused (see mongoid#983). In a project that uses will_paginate, this ...
- — RSpec + Capybara Don't Return a Proper Exit Code
We’ve been trying to fix an issue with our continuous integration where Capybara tests were failing, but the CI process reported success. Rather annoying for CI!
- — Compass: Invalid US-ASCII character 'xE2'
This one drove me crazy for a while. Compass would fail with “Syntax error: Invalid US-ASCII character “\xE2”. So I checked the files, found nothing changed since last time and ...
- — Delaying Image Processing on Heroku with delayed_job
There’s a Gem for That Too
- — RoR Win: 'Getting Things Done' with MongoDB Mongoid
- — :Slow Rails server in development? => :rails_development_boost
- — Rails + S3 + CloudFront + Jammit + Heroku + 100 грам
When someone says that you need a “100 grams” to figure something out, it means that it’s completely unobvious and complicated and therefore you need a few vodka shots. Vodka in...
- — Grape: API Authentication w/ Devise
Now that we have dealt with exceptions in our API we need to provide various methods of authentication. We’re going to be talking grape and devise.
- — Grape: trapping all exceptions within the API
We’ve been using Grape to provide a RESTful API. Grape is a micro-framework for Ruby that makes it really easy.
- — Wrapping the Idee PixMatch RESTful API in a Ruby Gem
I had a nice time today wrapping up the Idee PixMatch API in a Ruby gem. PixMatch is a general image matching engine that allows you to perform large scale image comparisons and...
- — VirtualBox: Linux on Windows
I am going to say nice things about Oracle software. Brace yourself.
- — Mongoid_fulltext: full-text n-gram search for your MongoDB models
- — CarrierWave: Saving Best Image Geometry
I recently needed to find out the geometry of the image being uploaded via CarrierWave. Images come in many different sizes and shapes. What I want is to have a “best” image and...
- — Rails: Passing Arrays in a Query String
I found this quite unusual. I needed to receive an array with some nested hashes part of a query string into a JSON API. Passing encoded JSON wasn’t looking hot. Turns out, in R...
- — A Rake Task for Copying MongoDB Databases
Now that we have a staging and a production environment, we want to copy all production data to staging at the same time as we push new code to staging via continuous integratio...
- — CarrierWave: Full Control over Changing (S3) Upload Path Name
Today, we will be uploading JPG, BMP or TIFF images to Amazon S3 that are attached to a model.
- — Continuous Deployment with Heroku-Bartender
You’ve heard about continuous deployment. But did you actually try to do it?
- — Models look nice, but sometimes you just want to change they way they feel
Mongoid models provide an excellent level of abstraction. Consider a User model.
- — Dan North doesn't believe in magic and makes babies cry
I’ve watched many Dan North’s InfoQ videos. I like 95% of what you say, Dan. But your latest Twitter whining on Ruby/Rails #fail have left my 2 y.o. son extremely disappointed. ...
- — Folder-Driven Development: when to create a folder?
- — Adding (almost) static pages to your fancy Rails website
So you’ve built the super amazing complicated Rails website. You are serving data from millions of documents from MongoDB, rendering complex objects using HAML and generally doi...
- — Seeding, exporting and importing MongoDB data with Rake
- — Rails: opinionated directory structure
One thing that has been irritating me is the default Rails app/models directory. It doesn’t support subdirectories, so models that deal with the database and classes that deal w...
- — Running ruby files on Heroku via rake
Let’s say you have some Ruby file that you want to run on Heroku. For example, I have stuff\things.rb. The easiest way to run the file on Heroku seems to inspire ourselves from ...
- — kernel.rb:27:in `should': uninitialized constant RSpec::Expectations::PositiveExpectationHandler (NameError)
This one took a while and required extensive help from a rocket scientist. While running RSpec I got this.
- — The program can't start because msvcrt-ruby18.dll is missing from your computer.
So I’ve been playing with Ruby. Yes, I am using a Windows 7 64-bit laptop and yes, despite the common message from most people on the Internet encouraging me to run Ubuntu, thin...
