Skip to content

Instantly share code, notes, and snippets.

@MichaelDrogalis
Created November 23, 2011 20:52
Show Gist options
  • Save MichaelDrogalis/1389875 to your computer and use it in GitHub Desktop.
Save MichaelDrogalis/1389875 to your computer and use it in GitHub Desktop.
class Workout < ActiveRecord::Base
2 has_one :duration
3
4 def long_hash
5 Digest::SHA1.hexdigest(self.id.to_s)
6 end
7 end
@MichaelDrogalis
Copy link
Author

class Duration < ActiveRecord::Base
2 belongs_to :workout
3
4 def to_s
5 self.hours.to_s + ":" + self.minutes.to_s + ":" + self.seconds.to_s
6 end
7 end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment