http://stackoverflow.com/a/8844734/2066866


On 7 May 2014 21:40, Adam Konner <notifications@github.com> wrote:

> In app/models/document.rb:
>
> > @@ -19,4 +23,20 @@ def display_organization
> >    def acceptances(countries)
> >      ratifications.where(country_id: countries.map(&:id)).includes(:country, :acceptance_level).map(&:acceptance).sort
> >    end
> > +
> > +  # Build a ratification object (or return an existing one) for each country.
> > +  def complete_ratifications
> > +    return @complete_ratifications if @complete_ratifications
> > +
> > +    # Generate placeholder ratifications
> > +    (Country.all - ratifications.map(&:country)).each do |c|
> > +      ratifications.build(:country => c)
> > +    end
> > +
> > +    @complete_ratifications = ratifications.sort_by(&:country_name)
> > +  end
> > +
> > +  def strip_blank_ratifications
> > +    self.ratifications.each { |r| r.destroy if r.blank? }
>
> I thought you said it was needed if you were changing a value
>
> --
> Reply to this email directly or view it on GitHub<https://github.com/thecartercenter/eos/pull/9/files#r12412589>
> .
>



-- 
Tom Smyth
Worker-Owner, Sassafras Tech Collective
Specializing in innovative, usable tech for social change
sassafras.coop *·* @sassafrastech