Ruby On Rails Classroom image

Neeraj  Amoli / Professional / Web Technology

 
To post your Question Join Classroom
 
Lesson Topics's No:-  First|1 | 2 | 3|Last
Lessons:-Subselects

The question mark syntax is fine, but when we want the same variable inserted in more than one place the second syntax is more convenient.

        The above discussion mentions that we will be adding a second occurrence of user_id in the SQL query. In particular, we can replace the Ruby code

 

This code contains a SQL subselect, and internally the entire select for user 1 would look something like this:

 

This subselect arranges for all the set logic to be pushed into the database, which is more efficient.13

     With this foundation, we are ready for an efficient feed implementation, as seen in Listing 11.45. Note that, because it is now raw SQL, followed_user_ids is interpolated, not escaped. (It actually works either way, but logically it makes more sense to interpolate in this context.)

 
 
 
image
Neeraj  Amoli

Skills    Ruby On Rails

Qualifications :-
Location :-Dehradun,Dehradun,Uttrakhand,India
Description:-

I have 3 year experience as a Software Engineer. My Skilled are Android Development (Java), ROR Development .   


Explore
 

  Students (0)