Skip to content

Instantly share code, notes, and snippets.

@tubbo
Last active December 2, 2015 19:55
Show Gist options
  • Select an option

  • Save tubbo/fd90aa08329808aec64e to your computer and use it in GitHub Desktop.

Select an option

Save tubbo/fd90aa08329808aec64e to your computer and use it in GitHub Desktop.
class Login < ActiveRecord::Base
def self.average_seconds_to_login
average :time
end
end
class LoginsDecorator < Draper::CollectionDecorator
delegate :average_seconds_to_login
def seconds
"#{average_seconds_to_login}s" if average_seconds_to_login.present?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment