Ruby on Rails Wednesday, August 24, 2016

I have signed up, and have enough time for your lessons and tasks.
thanks your invertation

2016-08-17 18:56 GMT+08:00 Mikhail Khomutetskiy <khomutetskiy@gmail.com>:
Hi!
I'm looking for 10-15 RoR developers who wants to become first users of my educational service http://procoder.io for free. This is limited offer, so I'm looking for motivated guys who can give me feedback.
- You are junior or between junior and senior RoR developer and want to improve your skills to become strong Senior
- You have 2-8 hours each week and motivation to read lessons and execute practical tasks
- We'll give you lessons + practical tasks that should improve your professional level a lot
- You can give feedback and reviews

For applying that free offer you need to sign up on http://procoder.io/ or reply to me

Thanks!

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/2487f740-393a-4191-af47-16f1cb52d3ca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CANxPo86EUKcFQWXH_dzqVDeX5%3DecJCuFrqm8GTy4ZC320t%3DfjQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

On 24 Aug 2016 1:49 p.m., "Bazley" <1975jmp@gmail.com> wrote:
>
> The first thing I do with it is this:
>
> if @new_relationships.any?
>
> So it looks like .any? affects the query? I would have thought rails would perform the query, get all the records into @new_relationships, and then count them. This is a surprising feature.

Surprising possibly, but it saved a lot of processor time. Such is the magic of rails.

Colin

>
>
> On Wednesday, August 24, 2016 at 1:26:54 PM UTC+1, Frederick Cheung wrote:
>>
>>
>>
>> On Wednesday, August 24, 2016 at 1:11:42 PM UTC+1, Bazley wrote:
>>>
>>> This rails/sql code...
>>>
>>>     @new_relationships = User.select('*')
>>>                              .from("(#{@rels_unordered.to_sql}) AS rels_unordered")
>>>                              .joins("
>>>                         INNER JOIN  relationships
>>>                         ON          rels_unordered.id = relationships.character_id
>>>                         ORDER BY    relationships.created_at DESC
>>>                         ")
>>>
>>> produces a query that begins like this:
>>>
>>>     SELECT COUNT(*) FROM (SELECT .....
>>>
>>> Why is it counting the records?? I haven't asked for a count. I simply want to select all columns after the join:
>>>
>>
>> The code you posted above doesn't actually run any query - queries are executed lazily. What are you doing with @new_relationships? 
>>
>> Fred 
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/41ec5676-836d-4079-b48c-b28b49a5326d%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLuELayRBmCnGrUHT7fRPgo8wYjfeBCHi0geY4cNRi2ufw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

The first thing I do with it is this:

if @new_relationships.any?

So it looks like .any? affects the query? I would have thought rails would perform the query, get all the records into @new_relationships, and then count them. This is a surprising feature.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/c9c4d2bb-6f00-4f7b-b355-071a576deec6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.