Minor code formatting changes

This commit is contained in:
Rohan Mitchell
2014-07-02 16:10:57 +10:00
parent c57148340c
commit 8f6a2575b7
2 changed files with 9 additions and 5 deletions

View File

@@ -159,20 +159,22 @@ class Enterprise < ActiveRecord::Base
self.relatives.is_distributor
end
def suppliers
self.relatives.is_primary_producer
end
def website
strip_url read_attribute(:website)
end
def facebook
strip_url read_attribute(:facebook)
end
def linkedin
strip_url read_attribute(:linkedin)
end
def suppliers
self.relatives.is_primary_producer
end
def distributed_variants
Spree::Variant.joins(:product).merge(Spree::Product.in_distributor(self)).select('spree_variants.*')
end
@@ -192,6 +194,7 @@ class Enterprise < ActiveRecord::Base
where('spree_products.id IN (?)', Spree::Product.in_distributor(self)).
select('DISTINCT spree_taxons.*')
end
# Return all taxons for all supplied products
def supplied_taxons
Spree::Taxon.
@@ -200,6 +203,7 @@ class Enterprise < ActiveRecord::Base
select('DISTINCT spree_taxons.*')
end
private
def strip_url(url)

View File

@@ -22,7 +22,7 @@ class Api::UncachedEnterpriseSerializer < ActiveModel::Serializer
end
def active
@options[:active_distributors].andand.include?(object)
@options[:active_distributors].andand.include? object
end
end