开发者

Add new model or extend existing one?

Hi I have a model Workout and model Set.

Workout has_many sets, set belongs_to workout.

Set has certain properties, like number of repetitions for left hand, for right hand, total repetitions etc.

Now I'm in front of a dilemma how to create additional/different kind of sets with different properties (say set for time, set that goal is to reach certain number of repetitions etc.)

Should I extend set model and change form via javascript based on some choice (it would be easier with counting statistics out of sets but IMHO it would make validation more 开发者_如何学JAVAcomplicated) or shall I create new kind of sets?

Ideas/tips ?

Thank you

Petr


I'd create a new model but If they're similar enough I'd use Single Table Inheritance and simply inherit say the statistics methods from Set.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜