c507e9302a
- ### Problem It's no longer possible to define a numeric validation on abstract class: ```ruby class AnimalsBase < ApplicationRecord self.abstract_class = true validates :age, numericality: { min: 18 } end class Dog < AnimalsBase end Dog.create!(age: 0) => ActiveRecord::TableNotSpecified: Dog has no table configured. Set one with Dog.table_name= ``` ### Solution Instead of trying to get the type for attribute on the class defining the validation, get it from the record being validated. |
||
---|---|---|
.. | ||
active_record | ||
arel | ||
rails/generators | ||
active_record.rb | ||
arel.rb |