Ruby on Rails Monday, May 4, 2015

On Mon, May 4, 2015 at 3:01 PM, Hemant Bhargava <lists@ruby-forum.com> wrote:
[...]
> 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.
[...]

Have book_publised_time field, and according to that, define derived
attributes on wheather the book is old, new, or very old. You don't
have to save user choice, fetch the data, check for condition and
according to that do your calculation.


Mrinmoy Das

--
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/CAB2gbt1YjUxieHQKiWCzGDfoG8NVfWpaobtT8HV%3DC_m3vE%3DYNQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment