Reset fields when no selected on save

Bit messy with private methods but I think we could probably abstract this further but wanted to get proper conditional validations in first and make sure all the forms are aligned.

other work address clearing still to do. Adding now...

btw, it's done in `valid?` so that any validations we add will take into account that these fields are blank. 
Let's leave the bang then. update_attributes doesn't update the db, it just iterates the hash and does send "#{k}=", v

Sent from my iPhone

> On 24 Oct 2014, at 16:23, Phil Thompson <notifications@github.com> wrote:
> 
> In app/forms/employment_form.rb:
> 
> > +
> > +  def clear_employment_terminated
> > +    self.end_date = nil
> > +    self.worked_notice_period_or_paid_in_lieu = nil
> > +    self.found_new_job = nil
> > +  end
> > +
> > +  def clear_notice_pay_period
> > +    unless worked_notice_period_or_paid_in_lieu
> > +      self.notice_pay_period_count = nil
> > +      self.notice_pay_period_type = nil
> > +    end
> > +  end
> > +
> > +  def clear_new_job
> > +    unless found_new_job
> doesn't update_attributes actually make a db call?
> 
> bang would be okay if there was a non-bang version.
> 
> —
> Reply to this email directly or view it on GitHub.