loading...

Cole Rau’s Flatiron School Sinatra Project

colerau profile image Cole Rau ・2 min read

Project Description:
I’ve created a Ruby CRUD MVC web app that allows users to signup, login, logout, write a review for a book, edit their review, delete their review, and see all the reviews they’ve made. A user’s reviews are persisted in a database unless a user decides to delete their review. One user cannot access another user’s reviews, nor login to another user's account. A user’s password is encrypted when it is stored in the database.

To login, signup, create a review, or edit a review, a user fills out a form. To logout, see a review, or delete a review, a user clicks a button.

My project’s schema (the database tables and their relationships to each other) is presented below:

schema

I used the following technologies in my project:

  • Sinatra
  • ActiveRecord
  • SQLite

Project Process:
My database caused several hiccups in my work-flow. When I wanted to re-seed my database, I ran

rake db:reset

in my terminal, but I received the following error:

ActiveRecord::AdapterNotSpecified: 'development' database is not configured. Available: []

My first attempt at a remedy was to delete my db folder. But when it wouldn’t return from my computer's trash folder, I decided to make a new Github repository. My ultimate solution to reseed my database was to delete just the .sqlite file in the db folder, then run

rake db:migrate

then

rake db:seed


In another subject, organizing my project’s code was a bit of a challenge. I had some trouble understanding which controllers to use for what reason. In the end, I had a sessions_controller, a users_controller, a books_controller, and a reviews_controller. In hindsight, I could have deleted the books_controller and moved the code into the reviews_controller. This would have made my project easier to understand for other developers.

The coding process wasn’t all a struggle - I did enjoy creating the forms and using some HTML to make my index page (http://localhost:9393/) look nice. I also added an image from Micah Ulrich’s fantastic online art collection. However, as a whole, I prioritized getting my code to function properly, rather than focusing on how my website would look to the end user.

My project’s code can be found here: https://github.com/colerau/sinatra_project_v3

Posted on May 20 by:

colerau profile

Cole Rau

@colerau

Student at Flatiron School in Seattle, WA

Discussion

markdown guide