Ruby on Rails: Building a Web App Aiding in Black Health

Ifeoluwa Akinremi Wade
1 min readJul 21, 2021

--

I will be blogging about nested resourcesand omniauth.

I have completed the third Flatiron project, which was built using the Ruby on Rails framework. Among the requirements of the project were nested resourcesand omniauth.

Nested Resources
What are nested resources?

Well, for starters, nested resources make life easier for everybody: The developer, and the user/consumer.

For the developer, nested resources establish a separation of concern — backend wise, when it comes to displaying parent/child relationships in routes and URLs. Ultimately, it involves cleaner, or DRYer code.

For the consumer/user, nested resources provide a readable and shareable link.

In my project, the nested resource relationship consisted of :doctors as the parent resource, and :reviews as the child.

Here the reviews are nested under doctors. Every action in reviews_controller will be associated with doctors.

This also establishes the separation of concern, which gives all the responsibility to the review_controller.

Because of this nested resource, the URL to create a new review of a doctor will look like this:

Omniauth
What is omniauth?

OmniAuth is a gem for Rails that lets you use multiple authentication providers alongside the more traditional username/password setup. ‘Provider’ is the most common term for an authentication partner, but within the OmniAuth universe we refer to providers (e.g., using a Facebook account to log in) as strategies.

— Learn.co

In other words,

I’ve always wondered how that features was built into our everyday web apps. For more information on OmniAuth — Click Here!

--

--

Ifeoluwa Akinremi Wade
Ifeoluwa Akinremi Wade

No responses yet