Rails - Show A Random Record But Not The Current
问题 At the end of a blog post I would like to display a teaser link to another random post. Obviously this link should be NOT a teaser for the current post itself. I figured already out how to choose a random post, but there is still the chance that the teaser link is a link to the current post. I couldn't figure out, how can I exclude this case. Here is my controller: def show @post = Post.find(params[:id]) @staff_pickrandom = Post.where(staff_pick:true).order("RANDOM()").limit(1) end I am quite