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::EventCustomField, Caboose::EventCustomFieldValue, Caboose::Export, Caboose::Font, Caboose::FontFamily, Caboose::FontVariant, Caboose::FormSubmission, Caboose::GiftCard, Caboose::Invoice, Caboose::InvoiceDiscount, Caboose::InvoiceLog, Caboose::InvoicePackage, Caboose::InvoiceTransaction, Caboose::LetsencryptPluginChallenge, Caboose::LetsencryptPluginSetting, Caboose::LineItem, Caboose::LineItemModification, Caboose::LoginLog, Caboose::Media, Caboose::MediaCategory, Caboose::Modification, Caboose::ModificationValue, Caboose::ModificationValueInputField, Caboose::Page, Caboose::PageCache, Caboose::PageCustomField, Caboose::PageCustomFieldValue, Caboose::PagePermission, Caboose::PageTag, Caboose::PageTemplate, Caboose::PageTemplateCategory, Caboose::PermanentRedirect, Caboose::Permission, Caboose::Post, Caboose::PostCategory, Caboose::PostCategoryMembership, Caboose::PostCustomField, Caboose::PostCustomFieldValue, Caboose::Product, Caboose::ProductCategorySort, Caboose::ProductDefault, 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::Subscription, Caboose::TaxLine, Caboose::Theme, Caboose::ThemeFile, Caboose::ThemeFileMembership, Caboose::User, Caboose::Variant, Caboose::VariantChild, Caboose::VariantDefault, Caboose::VariantLimit, Caboose::Vendor, Caboose::WishList, Caboose::WishListLineItem

Class Method Summary collapse

Class Method Details

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

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


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

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