<commit_before>class ProductCategory < ActiveRecord::Base
  include IslayShop::Statuses
  include Islay::Searchable

  search_terms :against => {:name => 'A'}

  extend FriendlyId
  friendly_id :name, :use => :slugged
  positioning :product_category

  has_many    :products, :order => 'position'
  belongs_to  :image,     :class_name => 'ImageAsset',       :foreign_key => 'asset_id'
  belongs_to  :parent,    :class_name => 'ProductCategory',  :foreign_key => 'product_category_id'
  has_many    :children,  :class_name => 'ProductCategory',  :foreign_key => 'product_category_id', :order => 'position'

  attr_accessible(
    :name, :description, :asset_id, :product_category_id, :published, :status,
    :position
  )

  track_user_edits

  def self.published
    where(:published => true, :product_category_id => nil).order('position ASC')
  end
end<commit_msg>Scope the ordering in the product category model by the table names.<commit_after>class ProductCategory < ActiveRecord::Base
  include IslayShop::Statuses
  include Islay::Searchable

  search_terms :against => {:name => 'A'}

  extend FriendlyId
  friendly_id :name, :use => :slugged
  positioning :product_category

  has_many    :products, :order => 'products.position'
  belongs_to  :image,     :class_name => 'ImageAsset',       :foreign_key => 'asset_id'
  belongs_to  :parent,    :class_name => 'ProductCategory',  :foreign_key => 'product_category_id'
  has_many    :children,  :class_name => 'ProductCategory',  :foreign_key => 'product_category_id', :order => 'position'

  attr_accessible(
    :name, :description, :asset_id, :product_category_id, :published, :status,
    :position
  )

  track_user_edits

  def self.published
    where(:published => true, :product_category_id => nil).order('product_categories.position ASC')
  end
end
{'fraction_non_alphanumeric': 0.12176308539944904, 'fraction_numerical': 0.0, 'mean_word_length': 4.801916932907348, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4414985', 'n_tokens_mistral': 586, 'n_tokens_neox': 563, 'n_words': 132}