On Tuesday, September 15, 2015 at 5:19:10 PM UTC+2, Jeremy Evans wrote:
>
>
> For this, I think you should just add a dataset method:
>
> class Post < Sequel::Model
> dataset_module do
> def viewable(user_id, follower_id)
> left_join(:users_followers, :following_id=>:user_id).
> where(Sequel.|({:privacy_id => 1}, :privacy_id => 2, :follower_id
> => follower_id), :status=>%w'published shared', :user_id=>user_id)
> end
> end
> end
>
> dataset = Post.viewable(params[:id].to_i, session[:user_id])
>
> If for some reason that won't work for you, please provide more detail as
> to why.
>
>
Hi Jeremy,
As usual, you save my day. I need to do some more manual digging to check
if everything is really as expected, but so far my tests are finally
passing with your advice.
That shows me some more features of Sequel i wasn't aware of, and i think i
should be able to improve some other parts of my code with the
dataset_module.
Many thanks,
Richard
--
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.