Charlie Massry

Charlie Massry

Written by Charlie Massry who lives and works in New York building useful things. You should follow him on Twitter

Using Transactions with Active Record

March 06, 2015

A transaction is a database feature where you can create, update, or delete multiple records from a database and if just one of them fails…

Pass Data Around iOS With NSUserDefaults

February 26, 2015

When dealing with the Model-View-Controller pattern, one of the problems you will face is that it is stateless, while the application itself…

Metaprogramming with Objective C

February 23, 2015

If you have fallen in love with Ruby’s support for metaprogramming like I did, but want to get into iOS development, fear not as there is…

Building a Blog Reader in iOS, Part 2

February 06, 2015

In iOS, you may want to create a bottom tab bar navigation as seen in any app where the type of interface varies differently, for example in…

Building a Blog Reader in iOS, Part 1

January 30, 2015

In this post, we will be building an app that retrieves a collection from the web and view it as a table. The data is an index of my blog…

Caching Rails Views

January 13, 2015

“There are only two hard things in Computer Science: cache invalidation, naming things, and off-by-one errors.” Fortunately for us, Rails…

Advanced Searching With SQL

January 09, 2015

Over on the left, you see that there is a nice little search box to search through my posts. When you search for something you might notice…

Getting Started With Objective C

January 08, 2015

If you have an iPhone, and want to be able to make apps for it, you might want to consider learning Objective C. For iPhone development, you…

Javascript Gotchas

January 06, 2015

Coming from Ruby, Javascript can be quite intimidating for a couple of reasons, mainly focused on the object system that it implements…

How to Debug Rails Apps

November 20, 2014

At any point in time, you can run into an error in your Rails App, but don’t worry as debugging can be easy with the help of multiple gems…

Metaprogramming with Method Missing

November 12, 2014

In Ruby, you can extend the language significantly to suit your preferences, and even overide methods already used by the language itself…

When Is It Okay to Monkey Patch?

November 03, 2014

Monkey Patching is a term in Object-Oriented Programming when you open up an existing class and add new methods to it. A good way to find…

Taggable Rails

October 30, 2014

The popular social media website Twitter has made features such as tagging through their system of hashtags very intuitive and fun. You can…

You Got Your Params in My URL

October 29, 2014

Oftentimes as Rails developers, we will run into a situation where we are making something polymorphic, and we won’t want to make any more…

Raw SQL on Rails

October 15, 2014

ActiveRecord is fantastic, but sometimes if you are doing complex joins and such, you may need to move away from ActiveRecord and write raw…

Mock external services with a VCR

October 10, 2014

When creating an Rails App using TDD, sometimes you will come across the need for an external service, for example, using the Google Maps…

Devise Guest User

October 09, 2014

Using Devise in Ruby on Rails can be very convenient for authentication, but there are some necessary workarounds that you must be aware of…

Devise on Rails

October 07, 2014

With most web apps, you’ll want to have some type of authentication system so your users’ data is secure. The question then shifts of how to…

Using Redis for Autocompletion on Rails

September 30, 2014

For a website that has search functionality, you might want to have autocompletion, so when the user starts typing it automatically pops up…

Google Maps on Rails

September 29, 2014

Previously, I had blogged about how to set up your website to make requests to match string addresses to latitude and longitude coordinates…

Geolocating on Rails

September 23, 2014

In this day in age, 2014, websites using location services are becoming more and more common to better serve customers as they can provide a…

AngularJS on Rails

September 16, 2014

Recently, I have started looking into AngularJS, a popular front-end Javascript MVC, to help me write cleaner, better, front-end code…

PostgreJSON

September 15, 2014

In PostgreSQL version 9.2, JSON storage functionality was introduced, so now it has the capability to be schema-less. From the outside…

Send Email on Rails with ActionMailer

September 03, 2014

In Ruby on Rails, ActionMailer allows you to email users from your server with processed Ruby code, which can serve any number of uses…

Nested Comments with Active Record

August 29, 2014

There are a couple of ways to let your users nest comments with Active Record. The main issue is the comments must start from somewhere…

Multiple Images with PaperClip

August 14, 2014

For any given web application, you probably want your users to be able to embed pictures or other types of multimedia for a richer…

NullUser On Rails

August 11, 2014

The Null Object Pattern is a popular software pattern that can be very useful as it can get rid of many nil checks in Ruby. Throughout your…

Ruby Enumerable, Part 2

August 06, 2014

The Enumerable module can be used for all of your Ruby classes as long as they implement their own each method. A good example of this are…

Ruby Enumerable, Part 1

July 31, 2014

The Enumerable module in Ruby can be used for arrays and hashes and can save you from writing complex, nested if statements and loops. all…

Javascript on Rails

July 24, 2014

The Javascript syntax is not nearly as fun as Ruby’s but you must use it if you want to do anything dynamic on the client-side. Fortunately…

Polymorphic Controllers???

July 21, 2014

That’s right, polymorphic controllers in Ruby on Rails. You made your model polymorphic, but now you would have to make a controller for…

User has_many selfies

July 16, 2014

When creating a self referential join through another table, you must think of each entry as a new row even if two of the columns have the…

to_param, the Best Method Ever

July 15, 2014

If you want to create vanity URLs, and who doesn’t, then to_param is the method for you. In fact it is my personal favorite method in Ruby…

What's the Point of TDD

July 14, 2014

At Metis, we haven’t been using test driven development to help develop our Ruby on Rails apps. Instead of learning TDD, we’ve been using…

Three Tables Are Better Than Two

July 10, 2014

In SQL, you can’t have two tables that have each other’s foreign key, you must use a third table to hold the foreign keys of the…

Light Authentication With Monban

July 08, 2014

If you want to have user authentication on Rails, but don’t require something as hard hitting as Devise or Clearance, Monban is the way to…

Nested Resources on Rails

July 02, 2014

There are a few key things you must remember when working with nested resources in Ruby on Rails. The first thing to do is edit your routes…

MVC...R?

July 01, 2014

Ruby on Rails follows the popular Model, View, Controller paradigm. One thing of note about this is Rails’s separation of the routes from…

Designing a Flash Card App in Sinatra

June 30, 2014

During the first week of Metis, we were tasked to build a flash card game playable from the command line. We kept adding features, and what…

HTTP Requests in Sinatra

June 27, 2014

In HTTP, there are four common request actions that are used by servers, GET, POST, PUT, and DELETE. This maps to CRUD, Create, Read, Update…

Database Control in Ruby

June 26, 2014

Active Record is the preferred method of interacting with a database. Being a Ruby Gem independent of Ruby on Rails, Active Record can work…

When in Doubt, Restart Your Server

June 25, 2014

This line of advice should always come in handy when working with Sinatra. We learned about the popular Domain Specific Language, Sinatra…

Recursion != Loop

June 23, 2014

I used to think that this statement would evaluate to true, until very recently, which is the reason for this blog post, and hopefully this…

Opening up Hashes with a Key

June 20, 2014

In Ruby, Hashes are a very powerful class that can store a key value pair. This is very useful if you need to create a database as you make…

SASS, the Sassy CSS Preprocessor

April 23, 2014

I have updated the site with SASS which has greatly cleaned up my CSS code and you should use it too. When I first started designing the…

Welcome.

December 22, 2013

I built this blog to showcase problems, solutions and thoughts about web development, web design and technology. That being said I did run…