Try:
def increment(article)
if request.referer != request.original_url
# increment code
end
end
Pergunta
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
Solução
Try:
def increment(article)
if request.referer != request.original_url
# increment code
end
end