... 1 2 3 4 5 6 7 ... 36 37 38 39 40 41 42 ... 81 82 83 84 85 86 87 88 |
... 1 2 3 4 5 6 7 ... 36 37 38 39 40 41 42 ... 81 82 83 84 85 86 87 88 |
0 class Section < ActiveRecord::Base 0 ARTICLES_COUNT_SQL = 'INNER JOIN assigned_sections ON contents.id = assigned_sections.article_id INNER JOIN sections ON sections.id = assigned_sections.section_id' unless defined?(ARTICLES_COUNT) 0 validates_presence_of :name 0 - before_create :create_p ermalink0 + before_create :create_p ath0 has_many :assigned_sections, :dependent => :delete_all 0 has_many :articles, :order => 'position', :through => :assigned_sections do 0 @@ -36,7 +36,7 @@ class Section < ActiveRecord::Base 0 while section.nil? && section_path.any? 0 - section = find_by_name(section_path.join('/')) 0 + section = find_by_path(section_path.join('/')) 0 page_name << section_path.pop if section.nil? 0 [section, page_name.any? ? page_name.join('/') : nil] 0 @@ -81,8 +81,8 @@ class Section < ActiveRecord::Base 0 # nasty regex because i want to keep alpha numerics AND /'s 0 - self.p ermalink = name.to_s.gsub(/[^\w\/]|[!\(\)\.]+/, ' ').strip.downcase.gsub(/\ +/, '-')0 + self.p ath = name.to_s.gsub(/[^\w\/]|[!\(\)\.]+/, ' ').strip.downcase.gsub(/\ +/, '-') if path.blank?
|
Comments
No one has commented yet.