ActiveRecord & wading through the trash that is…

Spent a frustrating week working on bending my head around activeRecord in the Ruby on Rails(RoR here after).  Specifically the has_many <table> :through <another_table> and how the RoR

  • 51+ stackoverflow articles
  • 8 screen casts
  • 8 partials of guides
  • 3 API documentation
  • 2 versions of ruby on rails
  • Minimal blocked time 3+5+9=17 hours, probably 3 hours lost to the interwebz one day (17-3=14), then another hour lost previously (14-1=13).

At this point I could have easily hand created an entire T-SQL database, tables and probably have written all the code in php.  Basically in the time I wasted, I could have finished the project & had free time left over…if my skills were as sharp in PHP/SQL as I remember from a little over 2 years ago.  Laugh here, because I am.

RoR is proving to be costly – because I’m stepping outside the scope of the tutorial by Michael Hartl (Link).  I checked and with my break due to issues – I am 3 years since I first read of ruby on rails and started coding.

For one of the supposedly best documented languages in frameworks today – learning to setup a rather simple join in SQL is a huge hassle in RoR.  I know it’s all about my intelligence, etc … but everyone talks about how simple/easy/etc RoR.  It’s tough to sift through the “build a website in 15 minutes” talk versus reality.

The extra layer of ActiveRecord makes it significantly harder to learn how to setup a database.  I can find millions of references for SQL work & support – but only thousands for ActiveRecord/ruby on rails (raw google ~670k for activerecord versus 235,000k for sql) – this is quick & dirty, maybe you can winnow the numbers down, but you can’t say they are comparable.  Of course, from those thousands of RoR articles & the millions of SQL ones, getting something similar to what I’m doing is significantly rarer.

I absolutely love the idea  of being able to change out your database whenever you desire – which is why I’m still pounding away at the murky “magic” of ruby on rails.

The fix was listed in the Ruby on Rails API titled for nested attributes, but I skimmed over it at least 5 times in the course of 3 weeks looking for the quick and easy fix.  Other languages are much more practical here.  I burned probably ~80 or 90 sites before I found an article that showed an actual explanation of the API in a way easy enough to recognize.  (Yes, the blame falls solely on me here or perhaps php for being easier to learn/use)
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s