Skip to content
  • Jonathan Hefner's avatar
    76b440f2
    Rework association model class error messages · 76b440f2
    Jonathan Hefner authored
    Follow-up to #46605.
    
    For a scenario like:
    
      ```ruby
      class Cat < ActiveRecord::Base
        has_many :lives
      end
    
      class Life
      end
      ```
    
    this commit changes the error from:
    
    > Rails couldn't find a valid model for the lives association. Use the
    > :class_name option on the association declaration to tell Rails which
    > model to use.
    
    to:
    
    > The Life model class for the Cat#lives association is not an
    > ActiveRecord::Base subclass.
    
    Additionally, for a scenario like:
    
      ```ruby
      class Cat < ActiveRecord::Base
        has_many :lives
      end
    
      class Live < ActiveRecord::Base
      end
      ```
    
    this commit changes the error from:
    
    > Rails couldn't find a valid model for the lives association. Use the
    > :class_name option on the association declaration to tell Rails which
    > model to use.
    
    to:
    
    > Missing model class Life for the Cat#lives association. You can
    > specify a different model class with the :class_name option.
    76b440f2
    Rework association model class error messages
    Jonathan Hefner authored
    Follow-up to #46605.
    
    For a scenario like:
    
      ```ruby
      class Cat < ActiveRecord::Base
        has_many :lives
      end
    
      class Life
      end
      ```
    
    this commit changes the error from:
    
    > Rails couldn't find a valid model for the lives association. Use the
    > :class_name option on the association declaration to tell Rails which
    > model to use.
    
    to:
    
    > The Life model class for the Cat#lives association is not an
    > ActiveRecord::Base subclass.
    
    Additionally, for a scenario like:
    
      ```ruby
      class Cat < ActiveRecord::Base
        has_many :lives
      end
    
      class Live < ActiveRecord::Base
      end
      ```
    
    this commit changes the error from:
    
    > Rails couldn't find a valid model for the lives association. Use the
    > :class_name option on the association declaration to tell Rails which
    > model to use.
    
    to:
    
    > Missing model class Life for the Cat#lives association. You can
    > specify a different model class with the :class_name option.
Loading