Yes, proof_for(user) makes more sense.

Andrea D'Amico


On Mon, Mar 17, 2014 at 8:17 AM, Akshat Pradhan <notifications@github.com>wrote:

> In app/models/requirement.rb:
>
> > @@ -2,5 +2,9 @@ class Requirement
> >    include Mongoid::Document
> >    field :name, type: String
> >    field :description, type: String
> > -  has_one :proof
> > +  has_many :proofs
> > +
> > +  def user_proof(user)
> > +    proofs.where(user: user).first
> > +  end
>
> I'm still looking to only attach 1 proof per requirement for now. The
> reason I was asking is because I was thinking the method could be renamed
> proof_for(user) but I wasn't sure. ;Akshat
> ... <#144cee6bc8271c09_>
>  On Mar 17, 2014, at 3:03 AM, Andrea <notifications@github.com> wrote: In
> app/models/requirement.rb: > @@ -2,5 +2,9 @@ class Requirement > include
> Mongoid::Document > field :name, type: String > field :description, type:
> String > - has_one :proof > + has_many :proofs > + > + def user_proof(user)
> > + proofs.where(user: user).first > + end It returns requirement's proofs
> filtered by user specified as argument. At the moment it returns just the
> first proof, but it's supposed to return all user provided proofs for a
> specific argument. Have you decided if you want multiple proofs by user for
> a single requirement? Le 17 mars 2014 00:25, "Akshat Pradhan" <
> notifications@github.com> a écrit : ... -- Reply to this email directly or
> view it on GitHub.
>
> --
> Reply to this email directly or view it on GitHub<https://github.com/akshatpradhan/compliance_chimp/pull/20/files#r10647164>
> .
>