String - name for same district
String - district uuid to modify
String - profile affected
String - scope at which this suggestion applies. One of: general, profile, district, node
enable JSON serialization which doesn't record object class
# File lib/admin/suggestion/types.rb, line 45 def self.important? false end
subclass instances just set attributes given
# File lib/admin/suggestion/types.rb, line 39 def initialize(attrs) attrs[:scope] ||= "profile" # most common attrs.each_pair {|attr,value| self.send("#{attr}=", value)} @type = self.class.to_s end
“ID” that should be unique across serialization or regeneration of the suggestion - subclasses should override as needed, or just specify instance variable names not to include in the hash.
# File lib/admin/suggestion/types.rb, line 32 def id(*ignore_vars) Digest::MD5.hexdigest(self.class.to_s + (self.instance_variables - ignore_vars).sort. map {|v| "#{v}=#{self.instance_variable_get v}" }.join) end
# File lib/admin/suggestion/types.rb, line 48 def important? self.class.important? end