Module: Models::SearchableView
- Extended by:
- ActiveSupport::Concern
- Included in:
- ViewAccountingTransmission, ViewActivity, ViewBudget, ViewCampaignDelivery, ViewCatalogItem, ViewCertification, ViewContact, ViewCoupon, ViewCreditApplication, ViewCreditMemo, ViewCustomer, ViewDelivery, ViewEmailTemplate, ViewEmployeeReview, ViewEstimatedLandedCost, ViewExchangeRate, ViewExpandedLineItem, ViewInventoryPlan, ViewInvoice, ViewItAsset, ViewItem, ViewItemCatalog, ViewItemLedgerEntry, ViewItemStat, ViewLeadTime, ViewLedgerEntry, ViewLineItem, ViewLineItemProfit, ViewLocatorRecord, ViewOpportunity, ViewOrder, ViewOutgoingPayment, ViewProductCatalog, ViewProductSpecificationValue, ViewPurchaseOrder, ViewQuote, ViewReceipt, ViewRma, ViewRoomConfiguration, ViewSalesByCustomer, ViewSalesCommission, ViewServiceJob, ViewStatementOfAccount, ViewSupplierItem, ViewSupportCase, ViewVoucher
- Defined in:
- app/concerns/models/searchable_view.rb
Overview
Shared behavior for read-only search views backed by database views.
Formerly BaseViewForSearch. Mixed into View* models (e.g.
ViewCustomer) to expose CRM link helpers, column presence checks, and
sales-rep filter scopes that are callable via Ransack.
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#crm_link ⇒ String
Relative CRM path to the underlying resource this view row represents.
-
#crm_link_subtitle ⇒ String
Subtitle shown under the record title in CRM search results.
-
#has_columns?(*columns) ⇒ Boolean
Checks that every named column has a non-blank value on this row.
-
#readonly? ⇒ Boolean
Search views are backed by database views and are never writable.
Instance Method Details
#crm_link ⇒ String
Relative CRM path to the underlying resource this view row represents.
29 30 31 |
# File 'app/concerns/models/searchable_view.rb', line 29 def crm_link "/#{self.class.main_resource_table}/#{id}" end |
#crm_link_subtitle ⇒ String
Subtitle shown under the record title in CRM search results.
36 37 38 |
# File 'app/concerns/models/searchable_view.rb', line 36 def crm_link_subtitle crm_link end |
#has_columns?(*columns) ⇒ Boolean
Checks that every named column has a non-blank value on this row.
44 45 46 |
# File 'app/concerns/models/searchable_view.rb', line 44 def has_columns?(*columns) columns.map(&:to_sym).all? { |column| !try(:send, column).nil? && try(:send, column).to_s.present? } end |
#readonly? ⇒ Boolean
Search views are backed by database views and are never writable.
51 52 53 |
# File 'app/concerns/models/searchable_view.rb', line 51 def readonly? true end |