2012-04-18 23 views
0

我從另一個繼承了一個模型,什麼都有店屬性,有時,當我試圖挽救兒童模特,其中有錯誤:store_accessor方法上驗證未發現

NoMethodError (undefined method `text' for #<Parent:0x00000007478ef0>) 

我的代碼:

class Parent < ActiveRecord::Base 
    store :data 
end 

class Child < Parent 
    store_accessor :data, :text 
    validates :text, :presence => true 
end 

什麼是問題?有任何想法嗎?

回答

0

剛剛嘗試在兒童類

class Child < Parent 
    store :data, :text 
    validates :text, :presence => true 
end 

定義和從父類中刪除店定義,它沒有任何意義的。