Great day again! Today at App Academy we worked on full Rails projects. There was one tutorial, then a normal Rails project.
The topic of the second project was amusing - it was a cat rental app. I wish such a thing existed, I might just rent a cat. Very much missing my cat Luna - she is back in NY.
There are two things that I just do not understand, so I am going to try to write out my thoughts here, in an attempt to gain some clarity…
The first thing I do not understand is validation. As an idea, it seems pretty simple: make sure that things in the database belong in the database. The specifics of validation include making sure that columns exist, making sure columns contain the right things, and making sure that the columns which point places have the right objects at the end of those pointers. Still, I wish this kind of stuff was generated automatically - with the ability to override defaults. When a column points at a foreign key, I expect something to be at the other end - shouldn’t Rails expect that too? Perhaps having to make validations manually has to do with the order that objects are created in? I am sure this will become clear to me as I work with ActiveRecord more.
Models and callbacks also confuse me. It seems like these can do a lot of things. Model functions can perform validations, delete objects, create objects…pretty much anything. Is a web app a bunch of rules wrapped around a database? It seems that way. Is the model the entire brains of the web app? I probably just have to learn the syntax better. No specific thing about models does not make sense…
Writing this out was helpful. Tonight I will learn this better by doing the tutorial again - applying it to a website I created a few months ago (my own project, using Wordpress). It will feel good to step back and improve some old work.
I am looking forward to HTML and CSS in the coming days. I already know HTML and CSS well, so there will be time for me to laser-focus on understanding the mysteries of ActiveRecord.