I am looking to pass an sti base class as a param and then be able to call all the child classes from that query. br/ This is my STI Class & Subclasses.
class LivingThing < ActiveRecord::Base
end
class Animal < LivingThing
end
class Plant < LivingThing
end
class Fungus < LivingThing
end
class Cat < Animal
end
class Dog < Animal
end
I would like to pass a param through a rendered form called "living_thing_type" so I can do this:
<%= render 'form', living_thing_type: "Animal" %>
living_things = living_thing_type.all
but even when I try this
living_thing_type.constantize.all
I get this error:
undefined method `all' for "Animal":String