joshk / completeness-fu

Simple dsl for defining how to calculate how complete a model instance is (similar to LinkedIn profile completeness)
http://blog.tty.nl/2009/09/23/100-completeness-fu/
160 stars 32 forks source link

multiple models #1

Open wakiki opened 14 years ago

wakiki commented 14 years ago

Does this support making an aggregate score based on multiple models?

eg. a person may have many addresses, pictures, jobs etc. each of which is a separate AR model

perhaps it could be checked using the symbols which links to another method?

wakiki commented 14 years ago

I've managed to implement this with:

check :groups, lambda {|p| !p.groups.empty? }

but may I suggest that empty arrays should be interpreted as a fail by default? This will then allow:

check :groups, :groups

which is much nicer

better still, it would be better to have syntax such as

check :has_groups, :has_blah_associations

upender-d commented 12 years ago

in my profile model i have has_many :technologies ,so how can i implement this to technologies?