class WarpEngine::SoftwareCategory
A category a software may carry (table software_categories): its key (the value of WarpEngine::Software category), a display label and position (scope ordered), and needs_review for categories registered automatically.
Public Class Methods
Source
# File app/models/warp_engine/software_category.rb, line 18 def self.register(key) return nil if key.blank? find_or_create_by!(key: key) do |category| category.label = key category.needs_review = true category.position = maximum(:position).to_i + 1 end end
Returns the category with key, creating it at the end of the order with the key as its label and needs_review set when there is none. Returns nil for a blank key.