Impressionist gem and Friendly_id

ruby-on-rails

Solution

Ok there is a work around. Just add impressionist(@model) in the show controller

def show
  @article = Article.find(params[:id])
  impressionist(@article)

   if request.path != article_path(@article)
      redirect_to @article, status: :moved_permanently
   end
   respond_to do |format|
    format.html 
    format.json { render json: @article }
  end    
end

Problem

I have a Rails app with impressionist and friendly id, I want to show page views in my articles. The problem is that impressionist is not registering the number of views. It's the same problem here on impressionist's bug tracker. My articles model: ``` class Article < ActiveRecord::Base is_impressionable extend FriendlyId friendly_id :title, use: [:slugged, :history] belongs_to :user belongs_to :category ``` Articles controller: ``` def show @article = Article.find(params[:id]) if request.path != article_path(@article) redirect_to @article, status: :moved_permanently end respond_to do |format| format.html format.json { render json: @article } end end ``` I also restarted the server, but having the same issue.

Original source