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' \>
STI不是問題......我糾正了。 – efoo
下面列出的Github問題在這裏:https://github.com/bcardarella/client_side_validations/issues/154 – jakeonrails