I'm a bit stuck with where to put some method calls (separation of
responsibility) and although I'm trying to do it just simply now in the
models, I think my problem raises a bigger question about Fat Models. But
that's another subject for another day.
Right now, I have ....
## has an a invitation_expiry date field.
My problem is when an invitation is made, I want to check if the invitation
has expired. I have thought of the following ....
1. include a method call in the Invitation model
## Check if the meeting (event's invitation) has expired (should it be
## Should the invitation know anything about the Event class?
def meeting_expired? ## event_invitation_expired?
meeting.invitation_expired? ## meeting.event.invitation_expired?
2. include an event_id foreign key in the invitations table so I can have
the same method as in the Meeting model
I'm happy with either one but am open to other ideas or what you would do.
The BIGGER question is, what exactly should go in the models?!! We talk
about Fat models, but for me, that doesn't fit nice with OO programming. To
me, it's quite clear that the we are not doing OO programming by stuffing
our models with everything related to that model. There needs to be another
level of abstraction to keep everything clean and have the separation of
I'm a self taught OO programmer and I come from a functional programming
background, so maybe I'm talking out of my hat. But while writing tests for
my app, to me, there are just too many code smells.
I look forward to your thought
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to firstname.lastname@example.org.
To unsubscribe from this group, send email to email@example.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.