Skip to content

Instantly share code, notes, and snippets.

@tal
Created February 4, 2010 17:34
Show Gist options
  • Save tal/294904 to your computer and use it in GitHub Desktop.
Save tal/294904 to your computer and use it in GitHub Desktop.
class InfoCount < Sequel::Model
unrestrict_primary_key
class << self
def [](*args)
ret = super(*args)
if args.size == 1 && !ret && args.first
ret = create(:user_id => args.first)
end
ret
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment