Feature/save custom attributes

I'm working on a fix for the ftrp records not getting updated.

Thank you for all the explanation. I'll walk through it in more detail when
I get in the office.

On Wed, Dec 3, 2014 at 6:58 AM, Anže Pečar <notifications@github.com> wrote:

> In src/ggrc/models/mixins.py:
>
> > @@ -465,8 +465,39 @@ def custom_attribute_values(cls):
> >              cascade='all, delete-orphan',
> >              )
> >
> > +    def custom_attributes(cls, attributes):
> > +        if 'custom_attributes' not in attributes:
> > +          return
> > +        attributes = attributes['custom_attributes']
> > +        from .custom_attribute_value import CustomAttributeValue
> > +        # attributes looks like this:
> > +        #    {<id of attribute definition> : attribute value, ... }
> > +
> > +        # 1) Delete all custom attributes for the CustomAttributable instance
> > +        db.session.query(CustomAttributeValue)\
>
> This is not where the problem is... Setting custom_attribute_values works
> without a problem and is not the issue. The issue is adding
> custom_attributes to full text search. The full text search properties only
> get cleared when the parent object changes (is dirty), but If we just
> create a few new attribute values like we do here (we don't really touch
> the parent object), the old values will not be cleared (again this only
> happens if the parent is dirty).
>
> A solution would be to somehow mark the parent object as dirty when we
> update custom_attributes, but I'm not really sure how to do that, maybe
> setting an updated_at of the parent object here in this function might
> solve the problem, but I'm not sure.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/reciprocity/ggrc-core/pull/2078/files#r21235911>.
>