Skip to content

aj-rom/hike-it-up

Repository files navigation

Hike It Up

A website to view and rate the best hiking spots around! This project is built on Ruby using Sinatra, ActiveRecord, and utilizing PostgreSQL for data storage. Hike It Up was built as a portfolio project for the Flatiron School.

Quick Links

Why?

This was a great way to get used to building out a project using the MVC architecture. I wanted to explore the possibilites of using Sinatra to build a web application and create object relations between users and something. Taking one of my passions, hiking, and merging it with my new found knowledge I arrived at Hike It Up.

What I hoped to learn

  • How to successfully authenticate a user within a sinatra application using bcrypt
  • How to utilize HTML forms along with Sinatra to perform CRUD based operations
  • How to build a MVC structured web application

Running the Application

Preview the production server on heroku here.

To Run this project locally:

  1. Clone this project.
  2. CD into the projects directory.
  3. Run bundle install
  4. Run rake db:setup to initialize your PostgreSQL database
  5. Start your server with either puma or puma -C config/puma.rb

Architecture Information

Most Viable Product Structure

Thinking of the base structure I went ahead and created models for users, trails, reviews, and trail images. Although only needed views for my users and trails models, as the others were children of these models. I ended up creating a personal reviews route for logged in users so they can easily manage their reviews.

Thus the structure for our objects looked like:

# user
  has_many: :reviews
  has_many: :trails, through: :reviews

# trail
  has_many: :reviews
  has_many: :trail_images
  
  # active record will automatically set this association for us
  # has_many: :users, through: :reviews
  
# review
  belongs_to: :user
  belongs_to: :trail
  
# trail image
  belongs_to: :trail

What can anyone do?

  • View all trails
  • View all users

What can a user do if they log in?

  • Edit their own profile information
  • Edit trail information
  • Leave a review on a trail

To implement this I created migrations using Rake to create the associated tables for the models I just created.

Stretch Features

What can anyone do?

  • Allow users to search trails by name
  • Allow users to search for a user by name/username

What can a user do if they log in?

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/'coachluck'/hike-it-up. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

Credits

  • bcrypt - Open-source password hashing algorithm
  • corneal - Sinatra app generator
  • tux - Dresses up Sinatra in a shell