2011-08-04 99 views
1

我正在使用client_side_validations gem。你如何建议让这个与STI合作?客户端验证和STI

class Vehicle < ActiveRecord::Base 
    validates :year, :presence => true 
end 

class Car < Vehicle 
    validates :cylinders, :presence => true 
end 

class Motorcycle < Vehicle 
    validates :drive_type, :presence => true 
end 

= form_for @motorcycle, :validate => true do |f| 
    = f.text_field :year 
    = f.text_field :drive_type 

输出:

<input id='motorcylce_year' type='text' \> 
<input data-validate='true' id='motorcylce_drive_type' type='text' \> 
+0

STI不是问题......我纠正了。 – efoo

+0

下面列出的Github问题在这里:https://github.com/bcardarella/client_side_validations/issues/154 – jakeonrails

回答

0

有趣。这可能是一个错误。你可以在Github上打开一个问题吗?