Render? Redirect? Re-evaluate my life?

File path from Doc-It


Holds our Controllers, Models, and Views folders.

>> Controllers

A Sinatra Controller is simply a Ruby class that inherits from Sinatra::Base. This is where a bulk of the code lives. These contain our RESTful routes that allow us to send our user to different pages throughout the application.

>> Models:

This hold’s the logic behind the application. It is where we establish our classes that inherit from ActiveRecord::Base. Within this we also establish our relationships with the user and in my case appointments.

User class contains validations(validates and has_secure_password) and has_many relationship with appointments
Appointment belongs to user.

>> Views:

This folder contains the code that is displayed in the browser to the user. Sinatra uses a templating engine called ERB, or Embedded RuBy to encapsulate the code that matches to the action being rendered.

render vs. redirect

We are relying on our GET and POST actions to tell us whether to redirect or render a file. If we are rendering a view, we are relying on the file path and it typically isn’t a page the user can directly link to. This is more so for our program to be able to retrieve the information we are trying to display.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store