From fc13598f794d27e6a486b950b5d3cbf7cc238d41 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Wed, 15 Feb 2017 13:20:42 +0100 Subject: [PATCH] Added the possiblity to inherit attribute filter and overwrite/extend via child methods. --- app/models/application_model/has_associations.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/models/application_model/has_associations.rb b/app/models/application_model/has_associations.rb index ff4ff47d3..0718aac30 100644 --- a/app/models/application_model/has_associations.rb +++ b/app/models/application_model/has_associations.rb @@ -105,6 +105,9 @@ returns next if !respond_to?(real_ids) attributes[real_ids] = send(real_ids) } + + filter_attributes(attributes) + Cache.write(key, attributes) attributes end @@ -164,12 +167,16 @@ returns attributes[destination] = user.login } + filter_attributes(attributes) + + attributes + end + + def filter_attributes(attributes) # remove forbitten attributes %w(password token tokens token_ids).each { |item| attributes.delete(item) } - - attributes end =begin