OSDN Git Service

fix edit extend_item
[pettanr/pettanr.git] / lib / validators / boost_validator.rb
1 class BoostValidator < ActiveModel::EachValidator\r
2   def validate_each(record, attribute, value)\r
3     resource = record.boosters[options[:resource_name].to_s].resource\r
4     msg = options[:message] || I18n.t('activerecord.errors.messages.extend_settings')\r
5     record.errors[attribute] << msg unless resource.valid?\r
6   end\r
7 end\r
8 \r