开发者

Client side validations and STI

开发者 https://www.devze.com 2023-03-25 18:33 出处:网络
I am using the client_side_validations gem. How do you suggest getting this to work with STI? class Vehicle < ActiveRecord::Base

I am using the client_side_validations gem. How do you suggest getting this to work with 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
en开发者_JAVA技巧d

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

Outputs:

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


Interesting. This might be a bug. Can you please open an issue on Github?

0

精彩评论

暂无评论...
验证码 换一张
取 消