Class: ActiveRecord::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/caboose/engine.rb

Direct Known Subclasses

Caboose::AbOption, Caboose::AbValue, Caboose::AbVariant, Caboose::Address, Caboose::ApprovalRequest, Caboose::Asset, Caboose::Block, Caboose::BlockType, Caboose::BlockTypeCategory, Caboose::BlockTypeSiteMembership, Caboose::BlockTypeSource, Caboose::BlockTypeSummary, Caboose::Calendar, Caboose::CalendarEvent, Caboose::CalendarEventGroup, Caboose::Category, Caboose::CategoryMembership, Caboose::CustomizationMembership, Caboose::DatabaseSession, Caboose::Discount, Caboose::Domain, Caboose::Font, Caboose::FontFamily, Caboose::FontVariant, Caboose::GiftCard, Caboose::LineItem, Caboose::LineItemModification, Caboose::LoginLog, Caboose::Media, Caboose::MediaCategory, Caboose::Modification, Caboose::ModificationValue, Caboose::ModificationValueInputField, Caboose::Order, Caboose::OrderDiscount, Caboose::OrderPackage, Caboose::OrderTransaction, Caboose::Page, Caboose::PageCache, Caboose::PageCustomField, Caboose::PageCustomFieldValue, Caboose::PagePermission, Caboose::PageTag, Caboose::PermanentRedirect, Caboose::Permission, Caboose::Post, Caboose::PostCategory, Caboose::PostCategoryMembership, Caboose::PostCustomField, Caboose::PostCustomFieldValue, Caboose::Product, Caboose::ProductCategorySort, Caboose::ProductImage, Caboose::ProductImageVariant, Caboose::RetargetingConfig, Caboose::Review, Caboose::Role, Caboose::RoleMembership, Caboose::RolePermission, Caboose::SearchFilter, Caboose::Setting, Caboose::ShippingMethod, Caboose::ShippingPackage, Caboose::ShippingPackageMethod, Caboose::Site, Caboose::SiteMembership, Caboose::SmtpConfig, Caboose::SocialConfig, Caboose::StackableGroup, Caboose::StoreConfig, Caboose::TaxLine, Caboose::User, Caboose::Variant, Caboose::Vendor

Class Method Summary collapse

Class Method Details

.pluq(field, compact = true, sort = true) ⇒ Object

(PLU)cks a single uni(Q)ue field



9
10
11
12
13
14
15
# File 'lib/caboose/engine.rb', line 9

def self.pluq(field, compact = true, sort = true)    
  arr = self.uniq.pluck(field)
  return [] if arr.nil?
  arr = arr.compact if compact
  arr = arr.sort if sort
  return arr
end