impressionist icon indicating copy to clipboard operation
impressionist copied to clipboard

NameError: undefined local variable or method `is_impressionable'

Open lymecca opened this issue 10 years ago • 9 comments

Hi, This gem is great! and it's working fine with rails 4.1.4 and ruby 1.9.3 but, in Rails Console, when I try to instance one new object or try to access one, I got this error msg bellow... NameError: undefined local variable or method `is_impressionable' for Ad (call 'Ad.connection' to establish a connection):Class.

I followed the instructions and put is_impressionable in the Class and impressionist(@ad) in the controller show action.

lymecca avatar Sep 16 '14 19:09 lymecca

experiencing the same thing

daslicious avatar Nov 05 '14 18:11 daslicious

Also experiencing this problem.

itskingori avatar Dec 26 '14 07:12 itskingori

Got the same issue

meliborn avatar Feb 14 '15 12:02 meliborn

+1

atif avatar Mar 19 '15 11:03 atif

This seems to still be an issue, from some online research it seems to be related to the loading order, I found some people that has identified the problem arise when you have RailsAdmin gem or other gems that may affect the loading order of the models. http://stackoverflow.com/questions/24183344/conflict-between-rails-admin-and-impressionist-gems I am still looking for a solution since this gem seems to provide the right functionality for a feature I'm trying to add to a project. But it seems is been around for a while already.

oscarsiniscalchi avatar Mar 24 '15 15:03 oscarsiniscalchi

After some struggle I got my branch to work, the only thing I needed to add was

class MyModel < ActiveRecord::Base
  include Impressionist::IsImpressionable
  is_impressionable
end

With this include statement the @widget.impression_count worked just fine. I also posted the answer on the SO thread I mentioned before. Hope it helps

oscarsiniscalchi avatar Mar 24 '15 18:03 oscarsiniscalchi

@oscarsiniscalchi It works. You saved my day.

CocaColaCat avatar Oct 08 '15 07:10 CocaColaCat

@oscarsiniscalchi Thanks!

wellington1993 avatar Apr 05 '16 17:04 wellington1993

Awesome, this totally helped me too. Thanks!

kathrynmbrown avatar Jun 13 '16 20:06 kathrynmbrown