Dairy Diary

12 June 2015


Dairy Diary is a cheese journal app built with Rails to help cheese enthusiasts keep track of cheeses they try, in journal form. Users can create new entries, add photos, thoughts and categorize the cheeses. Users can also search their cheese journal for cheeses they have tried in the past.


This project uses a pretty simple schema with 3 tables: Cheeses, Categories, and Users. Cheeses are the diary entries. Cheeses only have one category based on the 5 cheeses categories that exist: soft, semi-soft, firm, fresh, and blue-veined. These are actual categories that are used in the food industry, which I had to research. This app is not meant to be a social network, but a private cheese journal for users to record their thoughts, therefore, a user can only view their own cheese entries. In fact, a user can’t see other users in the app. Based on that schema, Cheeses belong to a User, and a User can have many cheeses, but users can’t see cheeses that belong to other users.

"Style Tile"

Design inspiration

For the design inspiration of this site, I simply combined the look and feel of two food-themed websites I already like: Full Plate Living (a client of mine at my old job), and The Ktchn, which is a food blog I read often.

"Inspiration: Full Plate Living" "Inspiration: The Kitchn"

The large image background on the homepage is meant to be inviting. The wide use of whitespace evokes a clean, elegant design, and a mix of modern sans-serif typography, with a slab serif font face for the logo and headlines to provide contrast and visual differentiation.


The site was completely built by me using Ruby on Rails, HTML5, and hand-crafted Sass, save for some Materialize.css for the form styles. I am using Devise for user authentication and Refile to handle photo uploads, but other than that, this was all created by me. You can view the code on Github or visit the live site on Heroku.

Lessons learned

This project taught me how to write a simple search query in Rails. I learned about using upper or lower, or ILIKE for case insensitive searches. A simple search query is quite easy:

def self.search(search)
	where("name ILIKE ? OR thoughts ILIKE ?", "%#{search}%", "%#{search}%")

I also learned about Devise and how it handles routing. When a user signs up or signs in, Devise automatically directs users to the root directory, but sometimes that’s now what you want to do. I wanted users to go to the Cheese index page upon signing in or registering. Most of the articles I read had a very complicated way to handle the redirect, which struck me as odd. Surely there should be an easier way to redirect the user to a different page… and there was! This is the code I ended up using, which I included in my Application controller:

def after_sign_in_path_for(resource)

I think this goes to show that there is always a simpler solution if you dig deeper in the documentation.