hzamani / active_record-acts_as

Simulate multi-table inheritance for activerecord models
MIT License
252 stars 86 forks source link

NameError: Undefined local variable or method actable #69

Closed Quynhnganguyen closed 7 years ago

Quynhnganguyen commented 8 years ago

Hello, I creates a simulate multiple table inheritance, Categories (Clothing, Car, Shoes, ...)

categorie.rb

class Categorie < ActiveRecord::Base
    actable
    validates_presence_of :nom_categorie
    has_many :annonces
end

clothing.rb

class Clothing < ActiveRecord::Base
    acts_as :categorie
end

And after, when I try to getting all the categories in annonce controller,

@categories = Categorie.all

I across this error.

How can I fix it?

so77id commented 7 years ago

i have same error :(

manuelmeurer commented 7 years ago

I'm pretty sure you just haven't loaded the gem properly. Did you add gem "active_record-acts_as" to your Gemfile, run bundle install and restart the server?

so77id commented 7 years ago

It was very strange what happened, the gem was well installed but nothing worked, until I reboot the computer and everything worked as it should be :(

Shit happens

hugomaiavieira commented 7 years ago

@so77id you may not have restarted spring server, if you use it.

adiakritos commented 7 years ago

In my case there is no server running while I run these tests. I'm trying to use this gem within a rails engine. Any thoughts?