app/models/digital_asset.rb in daengine-0.4.0.2 vs app/models/digital_asset.rb in daengine-0.4.0.3
- old
+ new
@@ -28,12 +28,13 @@
embeds_many :documents, :class_name => 'DigitalAsset::Document'
accepts_nested_attributes_for :documents
- default_scope {excludes(:'documents.content_type' => ContentType::XBRL_DOCUMENT)}
- #default_scope {not_in(:'documents.content_type' => [ContentType::XBRL_DOCUMENT])}
+ #Exclude XBRL documents from all queries
+ default_scope excludes(:'documents.content_type' => "LDJDCMAIK") #Had to use static value instead of a Constant
+
scope :title_is, ->(title) { where(:title => title)}
scope :business_owner_is, ->(business_owner) { where(:business_owner => business_owner)}
scope :guid_is, ->(guid) { where(:guid => guid)}
# scope :funds_in, ->(fund_id) { where(:fund_ids.in => fund_id)}
scope :audience_in, ->(audience_id) {where(:audiences.in => audience_id)}
@@ -49,10 +50,11 @@
scope :orderable, -> {where(orderable: true)}
scope :has_finra, -> {where(:'documents.content_type' => ContentType::FINRA)}
scope :audience_in, ->(audience) {where(:audiences.in => audience)}
scope :alphabetical, order_by(:title => :asc)
scope :not_xbrl, -> {excludes(:'documents.content_type' => ContentType::XBRL_DOCUMENT)}
- # scope :order_by_fund, order_by[[:product_ids, :asc]]
+ #scope :order_by_fund, order_by[[:product_ids, :asc]]
+ #default_scope {not_in(:'documents.content_type' => ["LDJDCMAIK"])}
# validations
validates_presence_of :guid, :title, :changed_at, :published_at,
:expires_at, :audiences, :documents