Vegan Niche, a Ruby on Rails Application

Erica Grundy
3 min readJan 31, 2021
Photo by Jiroe on Unsplash

My journey with Flatiron School’s Software Engineering Program continues with Ruby on Rails, a wonderful framework that optimizes our work. For this project, I decided to improve my last application which was a Sinatra based website where a user can discover vegan options at non-vegan restaurants.

In my last project, the user could create, read, update and delete posts with restaurants. For this one, I decided to leave the create action to an admin. The admin can create, read, update and delete posts, making the application cleaner and organized. The regular user can signup, sign in, sign out, and also create and delete its own reviews with ratings. The user is also able to update and delete its own account information.

For this project, I also included a search feature. Both users can search posts by restaurant’s names and options keywords. Another feature I thought would be useful is a Cuisine page, where both users can see restaurants by their cuisine. Only the admin, though, can add a cuisine and update a restaurant’s cuisine.

Just a little introduction on why I’ve decided to build something like this. Since before I started my journey as a software engineering student, I’ve always wanted to build a website where I would be able to help myself and other people find plant-based food at non-vegan restaurants.

Since my husband, family and friends are not vegan, I’ve always faced the challenge to go out with them. Usually, as soon as I know where we are going, I search all over the internet for vegan options at the chosen restaurant. However, a simple dinner becomes stressful when I deal with a last-minute invitation and I don’t have enough time to do my search.

Admin User

For the Admin User, I first looked at the ActiveAdmin gem, an administration framework for Ruby on Rails applications that allows us to generate an administration style interface. However, I thought it would be too easy to just use a gem for that. So I decided to make a simple admin back end without a gem.

To make it easier, I created a seed file where I wrote the code for a regular user and an admin user, and then I used rails db:seed to send these data to the database and have it ready for when I started the application. I also created a separated controller for the admin user (with cuisine and restaurant controllers), and separated views. Since the admin would have full access to the Restaurants and Cuisines actions, I put their actions for create, update and delete inside the admin controller.

For the regular user to be able to read the posts, I created their own controllers for restaurants and cuisine. At a first glance, it seems like a lot of work and code, but the Admin Page looks cleaner and more organized, with a simple list of restaurants and the actions for edit and delete. Only the admin user has access to the Admin Page.

I enjoyed developing this application and increasing my knowledge of Rails. It seems a lot to learn at first, but with time everything starts making sense. After these last two projects, I now understand how complex it is to develop a web application. I now appreciate more the work of software engineers.

I hope that Vegan Niche will evolve into a useful guide for those adventurers like me out there. Personally, I know I am gonna keep improving it and use it as my guide for eating out at non-vegan restaurants, and at the same time just focus on having a memorable time with people instead of spending time asking the waiter to find out if the soup has beef broth or not.

If you’re interested in viewing or contributing to this project, check out the Github Repository here.

--

--