On May 4, 2015, at 6:23 AM, Colin Law <clanlaw@gmail.com> wrote:
> On 4 May 2015 at 10:31, Hemant Bhargava <lists@ruby-forum.com> wrote:
>> Hi,
>>
>> Not being an expert in RoR, I have a logical query. It is not a
>> programming question.
>>
>>
>> Situation is :
>>
>> I have a Book model and status of the book can be anything from NEW,
>> OLD, VERY_OLD. It can be NEW, OLD both or it could be OLD and VERY_OLD
>> both. What would you suggest to implement in such a case? I wanted to
>> save user choice in database.
>>
>> I can create new model for Book condition but I feel that there must be
>> some other nice way to handle it. Is there?
>
> Is there any other information associated with the status? If not
> there is no point having another model. Just have boolean fields for
> each status and set them as appropriate. Or if there is a specific
> set of valid combinations (old, very old, old+very old etc) then you
> could use an enum field with a value for each combination.
Does a "Book" have many "Copies"? Are you looking to enter a Book once (as in Winnie-the-Pooh, Milne, A.A.) and then have a Copy in paperback, slightly foxed cover, sun-faded page edges, 6 out of 10?
I could definitely see an argument for not re-typing all of the bibliographic detail since it will be identical for different copies of the same book.
Walter
>
> Colin
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLtOKX5z_OpxGs6qJbVkzPZj_T6hj312jWQfb4933aHCew%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/01D28A8D-95FA-4312-907B-A68AA13F10D7%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment