Skip to content

Instantly share code, notes, and snippets.

@cheald
Created October 27, 2012 20:52
Show Gist options
  • Save cheald/3966197 to your computer and use it in GitHub Desktop.
Save cheald/3966197 to your computer and use it in GitHub Desktop.
class User
FILLABLE_ATTRIBUTES = [:name, :age, :sex]
def profile_percent_complete
FILLABLE_ATTRIBUTES.inject(0) {|c, u| c += send(u).present? && 1 || 0 } / FILLABLE_ATTRIBUTES.length.to_f
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment