Search code examples
ruby-on-railsrubysingle-table-inheritance

How to create a Select which let's you choose between valid types with single table inheritance in Ruby on Rails


i'm using Single Table Inheritance in ruby on rails to model various animals. So i have a base Animal Class and then i have various subclasses in the models/animal folder.

When the user creates an animal, i want to show a select of the various animal types which allows the user to choose a "valid" animal ( which means one animal for which a class exists ).

How can i do this?


Solution

  • Your two choices are