Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

ActiveRecord allows you to query the database directly using execute() or use a query to populate ActiveRecord objects with find_by_sql().

execute() returns the result in whatever form the underlying database driver uses. I think that's about as transparent an abstraction you could ask for. You can completely ignore ActiveRecord's abstractions.

find_by_sql() returns an array of ActiveRecord objects.



thats not transparent that's discardable. Transparent would be knowing what happens when you don't use execute() or find_by_sql(). Just because a library allows you to avoid using it in the way it was intended to be used the most doesn't make it transparent. That just means it realizes that sometimes you have to discard the libraries features and do something else.


exactly. it's nice that AR makes it easy to go down a layer, but then you're no longer abstracting away the database.

edit: to be fair, I was less than precise in my earlier post when I said that ActiveRecord wasn't totally transparent. I was specifically referring to AR as an abstraction that can be used identically across various different databases.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: