Easy Travel is an app meant to help users plan trips and save their travel plans.
You can generate your Rail API with this command in your terminal:
rails new my_api — api
This provides the appropriate gems and configurations to allow Cross-Origin-Resource-Sharing, enabled by installing and configuring ‘rack-cors’. Specifying -api will prevent unnecessary erb files from being created.
Now that cors is implemented, it’s possible to link the frontend to the backend. …
Many-to-Many Relationship and Simple Calendar Rails Gem
I decided to create a Salon Managing application for my third project at Flatiron Bootcamp.
The requirements included creating a many-to-many relationship while using the Ruby-on-Rails framework. The strategy I’ve become familiar with so far is implementing the has_many :through method within our class models.
Creating a join table allows us to have a many-to-many relationship between our tables.
In this case, a client sees many stylists, through their appointments; while stylists have many clients, through their appointments.
We have to create associations between our models for this join table to take effect.
I created this project for Phase 2 of Flatiron Bootcamp. It’s structured as a CRUD, MVC(Models-Views-Controllers) app using Sinatra.
What is Sinatra?
Sinatra is a Domain Specific Language implemented in Ruby that is used to fit into any Rack-based application stack. It has a bunch of pre-written methods that turn our applications into Ruby Web Apps.
Within the app, you’re required to manually set your routes in order to render the correct HTML views and redirect to the correct user destinations.
What is CRUD? CREATE — READ — UPDATE — DELETE
CRUD represents the four basic functions our MVC structure…