문제

My problem is to get referer after page refresh. I need to find out if the user does not reloaded page. In my articles_controller i check before article.views_count increment

def increment(article)  
  if request.referer != article_url(article)
    # increment code
  end
end

but request.referer returns url, that was before reload and after each page refresh method increment is running

도움이 되었습니까?

해결책

Try:

def increment(article)  
  if request.referer != request.original_url
    # increment code
  end
end
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top