ROR newbie coming from a PHP background here.
I have a model that inherits from ActiveRecord::Base. I would like to
extend that into two further models, to separate functionality from
each other. Basically:
class Person < ActiveRecord::Base
class Male < Person
class Female < Person
How can I write a method within Person that will detect what gender
has been defined and return the proper object based on it?
I’m thinking something like…
gender_class = self.gender == ‘Female’ ? ‘Female’ : ‘Male’
In that version, though, “self.gender” isn’t recognized. I’m sure I’m
missing something really basic, but can someone point out what it is?