Skip to content

Commit

Permalink
using core array api
Browse files Browse the repository at this point in the history
  • Loading branch information
guilhermesilveira committed Aug 17, 2010
1 parent 6d03205 commit b70c449
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/restfulie/server/core_ext/array.rb
Expand Up @@ -42,10 +42,10 @@ def to_atom(options={}, &block)
# albums.updated_at(:created_at)
#
def updated_at(field = :updated_at)
map { |item| item.send(field) if item.respond_to?(field) }.compact.max || Time.now
max_by {|o| o.send(field)} || Time.now
end

def published_at(field = :published_at)
map { |item| item.send(field) if item.respond_to?(field) }.compact.min || Time.now
min_by {|o| o.send(field)} || Time.now
end
end

0 comments on commit b70c449

Please sign in to comment.