Need advice on design in Ruby On Rails
Posted
by
Elad
on Programmers
See other posts from Programmers
or by Elad
Published on 2014-03-21T11:53:00Z
Indexed on
2014/05/28
15:55 UTC
Read the original article
Hit count: 422
For personal educational purposes I am making a site for a conference. One of the object that exist in a conference is a session, which has different states and in each state it has slightly different attributes:
- When submitted it has a speaker (
User
in the system), Title and abstract. - When under review it has reviews and comments (in addition to the basic data)
- When accepted it has a defined time-slot but no reviewers anymore.
I feel that it is not the best thing to add a "status" attributes and start adding many if
statements...
So I thought it would be better to have different classes for each state each with it's own validations and behaviors.
What do you think about this design? Do you have a better idea?
*I must add this out of frustration: I had several edits of the question, including one major change but no one actually gave any hint or clue on which direction should i take or where is a better place to ask this... Hardly helpful.
© Programmers or respective owner