On 8 January 2011 10:43, Mauro <[email protected]> wrote:
> On 8 January 2011 11:23, Colin Law <[email protected]> wrote:
>
>> If expiry date can always be calculated from issue date then it is
>> wrong to put expiry date in the database.  It increases the database
>> size and access time but also adds complexity to the code.  For
>> example you have to remember to update it whenever the issue date is
>> changed.  If you use a method to access it the code is simpler.  Note
>> that other code accessing curc.expiry_date will not see any difference
>> between a value stored in the database and the access method I have
>> suggested.  This is known as a virtual attribute.  You might like to
>> google for database normalization if you want to find more about how
>> to design the database.
>
> Thank you for very useful information.
> I should put protected the instance method in the model?

If you do that then it will not be able to be used in controller or views.

Colin

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to