Thursday, November 29, 2012

[Rails] Re: Are Rail's database tools really helpful?

Hi,

Am Mittwoch, 21. November 2012 11:56:58 UTC+1 schrieb Ruby-Forum.com User:

In a real world application, you don't just play with one table at a
time. You have to write long SQL requests, with several tables

No in my application I am not working with tables at all, I am working with objects, 
e.g I have a customer object or an order object.

If I need a list of open order items for a customer I write:
  items = customer.order_items.open.all
 
if I would use SQL I have to join the customer table with the order table and the order items table
using a where condition getting a more or less complicated sql string


Instead of writing a simple SQL request, you write a complicated set of
methods' invocations (with options...).

The resulting code is not easy to read. You think : I should write an
easy to read SQL request!
 
So if you find the above code "not easy to read" please post the corresponding sql code ;-)

Greetings

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/6o85tEKWSgUJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate