August 12, 2015 Log No. 330

I Had NO Idea

Yesterday I said “ActiveRecord seems much more built out.” Talk about understatement of the CENTURY. And I thought Ruby was high level. HA! Basically, in ActiveRecord, if you can dream it, you can do it. (Sidenote: I always attributed that to Blades of Glory but apparently it’s from Walt Disney?)

My partner was a much more willing believer and oftentimes said, “Maybe it really is so easy as referencing the association we created as a method?” And I was all, “Yeah ok, sure, except how would it know THAT? We didn’t define anything at all!” Guess who looked like a fool today. AR really takes metaprogramming to the next level. All you have to do is mention a variable in PASSING in a model and suddenly you can do any/everything you would ever think to do with said variable. It’s insane. I suppose you could tell my mind would be blown today when I had trouble even believing 10.minutes.ago was a valid method. I mean, 10 is a FixNum! (Apparently it’s a Rails method so Ruby at least would appreciate my incredulity.)

But really, AR is taking the best of Ruby and SQL and making them scary accessible with minimal coding necessary. And this was just the first day, so tip of the iceberg. Tomorrow’s going to be joins and includes and Relation objects and dynamic filtering and looking at the readings, I don’t even know if I can call it code at this point, it just looks like English. Maybe with a few more colons and parentheses but that’s it.


Leave a Reply

Your email address will not be published. Required fields are marked *

*