Advertisement
rotemcohen

Untitled

Feb 21st, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.47 KB | None | 0 0
  1. Relationship.includes(:follower, followed: :funz).active.each do |relationship|
  2.   relationship.followed.funz.each do |funz|
  3.     follower = relationship.follower
  4.     if funz.active? && funz.visible && !funz.b2b && follower.orders.confirmed.by_funz(funz.id).empty?
  5.       bookmark = follower.bookmarks.find_or_initialize_by(funz_id: funz.id)
  6.       if !bookmark.active
  7.         bookmark.update_attributes(bookmark_source: 'follow-host', active: true)
  8.       end
  9.     end
  10.   end
  11. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement