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.
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.
- 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
Preview the production server on heroku here.
To Run this project locally:
- Clone this project.
- CD into the projects directory.
- Run
bundle install
- Run
rake db:setup
to initialize your PostgreSQL database - Start your server with either
puma
orpuma -C config/puma.rb
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
- View all trails
- View all users
- 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.
- Allow users to search trails by name
- Allow users to search for a user by name/username
- Add an image to a trail
- Add captions to images
- Delete/Edit their reviews
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.