ruby + rails + church wafer javascript project 004 - communal recipes
former title: flatiron school portfolio project 004 + church wafer javascript
i’ve been working on my fourth portfolio project for flatiron while doing a west coast tour of the United States. inspired by my friends, ardent lovers of good food made with care and consideration, i decided to make my application about recipes. i find that the flatiron school has a solid, tight curriculum - everything i’ve learned in the program so far has built upon each other.
in a specific programming language (Ruby) you start by learning about basic programming (basic operators, syntax, loops), then learn about object-oriented programming, then you learn about HTML, CSS, SQL, then you learn a lightweight Ruby framework (Sinatra), then a more powerful Ruby framework (Rails), then using Ruby and Rails with vanilla (meaning basic, or church wafer) Javascript, and finally we’ll learn to use a powerful Javascript framework (React). I appreciate that we get to learn and spend a considerable amount of time working with the basic languages before getting into the higher-level, abstracted frameworks so we can understand how for instance Rails or React functions and libraries are operating at a deeper level.
our project requires us to develop a Rails API application, which Rails handily allows you to do by providing an API flag. so instead of
rails new my_app
you also add the api flag,
rails new my_app --api
and this will do three things:
- remove some middleware related to browser functionality
- ApplicationController inherts from ActionCtronller::API instead of ActionController::Base
- if you use rails generator (e.g.
rails g resource
orresources g controller model
) it will skip the creation of views, helpers, other browser assets
You might want to use Rails as an API application in order to build out a back-end, and then you can use another language or framework for your frontend. In our case, we are using Javascript, a language originally designed for the front-end and is very popular and mature enough to have many additional front-end features that Rails alone cannot compete with. API functionality is what ties everything together - Rails communicates with Javascript by sending data (resources) in a lightweight, interoperable format.
Learning about Ruby has primed me to learn about Javascript, in particular object oriented Javascript. There’s still a bit of additional complexity that we’re learning with Javascript that I’m still trying to wrap my head around, such as scope, and web technology concepts I’m familiarizing myself with such as asynchronous events (fetch() and AJAX), targets, and DOM terminologies.