hzamani / active_record-acts_as

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

model.specific returns nil #70

Closed eltoob closed 7 years ago

eltoob commented 8 years ago

I am migrating from act_as_relation and I have the current architecture

merchant_account.rb

class MerchantAccount < ActiveRecord::Base
  actable
end

test_merchant_account.rb

class TestMerchantAccount < ActiveRecord::Base
  acts_as :merchant_account, as: :as_merchant_account
end

Then I can properly create a merchant account object, but can't call specific on the generic object

test = TestMerchantAccount.create(name: "test")
test.merchant_account.specific => nil

As a FYI my merchant account model contains a as_merchant_account_id and as_merchant_account_type

Any idea on why specific is not working?

manuelmeurer commented 7 years ago

Try adding the as: : as_merchant_account to the actable call as well.

Please reopen if this problem still exists with the latest gem version.