Using order('RANDOM()').limit(1)
is the right way to start since it is better to let the DB choose a random record, than fetching a large set of ids, and letting Ruby sample from an array. In order to avoid choosing the post you are currently on use where.not
to exclude that post
Post.where(staff_pick: true).where.not(id: @post.id).order('RANDOM()').limit(1)
or
Post.where(staff_pick: true).where('id != ?', @post.id).order('RANDOM()').limit(1)