Skip to content

Instantly share code, notes, and snippets.

@lucashungaro
Created May 14, 2012 00:49
Show Gist options
  • Save lucashungaro/2690968 to your computer and use it in GitHub Desktop.
Save lucashungaro/2690968 to your computer and use it in GitHub Desktop.
SRP snippet 1
class Game < ActiveRecord::Base
belongs_to :category
validates_presence_of :title, :category_id, :description,
:price, :platform, :year
def get_official_price
open("http://thegamedatabase.com/api/game/#{name}/price?api_key=ek2o1je")
end
def print
<<-EOF
#{name}, #{platform}, #{year}

current value is #{get_official_price}
EOF
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment