[Rails] Time-dependent values/constants in Models: An issue or not?
Hi there,
I remember reading in the comments of a Rails blog something along these
lines:
"Since a Model is loaded only once in production development (at server
start), certain time-dependent 'constants' that you have placed in a
method of a Model will always return the same value for those
'constants', i.e. the value the 'constant' had at server start."
Hypothetic example for the MySQL 'constant' "UTC_TIMESTAMP()" in a Model
'User':
=====
def books_created_right_now
self.books.find(:all, :conditions => "books.updated_at =
UTC_TIMESTAMP()")
end
=====
Is the above statement utter BS or is there actually some issue similar
to the example or statement?
Thanks a lot!
Tom
--
Posted via http://www.ruby-forum.com/.
--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home