Hi,
I want to cache objects only if they were published at least 5 days ago.
He is the code I've done, but I don't like because it is not dry...
How could I improve it?
<% if job.published_at < 5.days.from_now %>
<p class="title"><%= job.title %></p>
<p class="location"><%= job.location%></p>
<p><%= distance_of_time_in_words(DateTime.now, job.published_at)
%></p>
<% else %>
<% cache job %>
<p class="title"><%= job.title %></p>
<p class="location"><%= job.location %></p>
<p><%= job.published_at %></p>
<% end %>
<% end %>
Greg
--
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 [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.