- Jun 15, 2001
I just want to make a quick note here.
RonaldMcDonald's php code is less than 15 lines of simple, easy-to-follow php.
Novo's ruby/rails code is almost 30 lines spread across 4 files (and ends his post with "Simple." ).
If you've never heard of MVC or haven't used any web frameworks before you may think that Novo is nuts. He's not. Although the ruby he posted is definitely more complicated structurally than the equivalent non-framework php, this is actually how anything larger than a very simple dynamic website should be done, with presentation (html) separate from logic (db access et al).
Edit: I know almost nothing about ruby or rails, but something that keeps me from diving in head first is...well, the concept of automated db access in general. Am I really going to let something write my sql for me? I really enjoy hammering out a nice query that does exactly what I need it to do, complete with inner/outer joins, unions, subselects, likes, ins, and whatever else is necessary with the appropriate indexes. For simple "select * from table where col=value" queries fine, do it for me, I won't mind. But for anything complex, can I take over? I know Hibernate allows me to take over when necessary. I don't yet trust the efficiency of a cruise controlled database.
Yes, there is a Person.find_by_sql method, among other things you can do to tweak the underlying SQL queries.
In general you don't need to, as long as you use sensible indexes for the types of queries you know rails will be doing for you.
Aug 9, 2007 02:05