1

我正在使用 client_side_validations gem。你如何建议让它与 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' \>
4

1 回答 1

0

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

于 2011-08-10T07:44:47.527 回答