Inky Code


Niky Morgan: New York-based Web Developer

Saving Database Space with Rails Enums

I have an app that is running out of database space. It is a shared Rails project with colleagues and we host the app on Heroku, so it has a 10,000 row limit. Since I clean up the database regularly to remove unused data, I decided to focus on other fixes that might decrease the amount of space we are utilizing.


Humor as a Pedagogical Technique

Now that Flatiron School has grown to five campuses, we have many more instructors on the team. In addition to sharing general lecture tips, we frequently share ideas for domains and code examples to use. One domain that has been passed down through several generations of instructors appears in a set of first-week lectures. Over the course of a few lectures, we teach the students the basics of object-orientation and increasingly complex relationships. The domain is Twitter: a user has many tweets and a tweet belongs to a user. By the final lecture, we add in the concept of favoriting another user’s tweet. With a new favorite model joining a user and a tweet, we introduce a many-to-many relationship. A user can have many favorites, a tweet can be favorited many times, and a favorite joins one user to one tweet.


Many to Many Associations with ActiveRecord

I’ve spent the past three months in Ruby-and-Rails-land, teaching dozens of Flatiron students the basics of ActiveRecord. One of the concepts we really focus on early in our curriculum is the many-to-many relationship. We have students use the has many through ActiveRecord association for this, but at some point they stumble upon the has and belongs to many association and wonder what the differences are between the two.


Creating a Contact Form with AWS Lambdas

I recently moved my web hosting to AWS. (Blog post here.) I knew from friends that hosting a static site on AWS is relatively cheap and easy, so I was sure I’d be able to make the switch. However, I didn’t take the time to consider that not all the elements of my site were static.


Redirecting a WWW Subdomain on AWS

While the instructions for redirecting a www subdomain to the apex (base) domain on an AWS-hosted site may not encompass many steps, I had to employ a fair amount of googling and testing in order to get this working on my site. My website is nikym.org, and I wanted to ensure that any requests to www.nikym.org redirected to nikym.org. Furthermore, I wanted any requests to an HTTP version of the site to redirect to the HTTPS version.