On Monday, November 23, 2015 at 1:52:07 PM UTC-8, Sylver wrote:
>
> Thanks Jeremy.
>
> You already told me that's a bad design to do like that, which i agree on.
> The only reason for doing it in this way is that's the only way i figured
> out to generate only one query (with a IN) for all returned elements,
> instead of one for each. But maybe there's a better way ?
>
The example I gave below should only use a single query, and doesn't
require using a global variable to share data between your model code and
your web code. Is there a reason that wouldn't work in your case?
Thanks,
Jeremy
>
>
> On Monday, November 23, 2015 at 5:00:50 PM UTC+1, Jeremy Evans wrote:
>>
>>
>> Note that it's a bad idea to have your model code depend on your web
>> code. A better way to do this would be to do the following in your web
>> code:
>>
>> obj.followers{|ds| ds.where(:follower_id=>session[:user_id])}
>>
>>
>
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.