On Mon, 17 Jul 2006, Joerg D. wrote:
I wanted to exploit missing_method in some way, so that I don’t have to
write a whole lot of extra methods like you described. Also, as my
Person model grows, I want all these attributes to be automagically
To me it sounds like a sign that the domain model isn’t right. The
fact that Employee needs the same behavior as Person suggests a
The Employee model is basically the model to describe the relationship
between a person and an employer. In it I can record extra employee
specific data. I also have other types of people, like contacts etc. I
thought of not going the STI route, in case we want to store all the
people in an LDAP directory …
The word “employee” definitely means a person, not a relationship
between a person and a company. If you want to model the
relationship, you should probably call it a position, or a hiring, or
something like that. That would also force the issue of clarifying
what’s a person and what isn’t.
Plus, by having an employee model (separate from a person model), allows
me to create RESTful URLS more easily - ie I’m giving the person context
wrt to an employer within the URL structure.
(I’ll leave that part to you; I’m still working on figuring out why
I’m supposed to care about URLs so much
Dunno - am I being to abstract about it all?
I just think “employee” is the wrong concept for a relationship
between a person and an employer, and that the need for method_missing
is a sign that the domain model isn’t right.
I want to be able to say: @employee.lastname, instead of saying
Posted via http://www.ruby-forum.com/.
Rails mailing list
http://www.rubypowerandlight.com => Ruby/Rails training & consultancy
http://www.manning.com/black => RUBY FOR RAILS (reviewed on
http://dablog.rubypal.com => D[avid ]A[. ]B[lack’s][ Web]log
[email protected] => me