Index: app/models/query.rb =================================================================== --- app/models/query.rb (Revision 17228) +++ app/models/query.rb (Arbeitskopie) @@ -222,6 +222,7 @@ errors.add(:base, l(:label_role_plural) + ' ' + l('activerecord.errors.messages.blank')) if query.visibility == VISIBILITY_ROLES && roles.blank? end + after_initialize :set_global_attribute after_save do |query| if query.saved_change_to_visibility? && query.visibility != VISIBILITY_ROLES query.roles.clear @@ -359,9 +360,8 @@ @queried_table_name ||= self.class.queried_class.table_name end - def initialize(attributes=nil, *args) - super attributes - @is_for_all = project.nil? + def set_global_attribute + @is_for_all = project.nil? end # Builds the query from the given params