Skip to content

Commit cde48f4

Browse files
committed
Fixed problems with scoping.
1 parent face68a commit cde48f4

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

app/models/cms/section.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class Cms::Section < ActiveRecord::Base
55
has_one :node, :class_name => 'Cms::SectionNode', :as => :node, :dependent => :destroy
66
#The nodes that link this section to its children
77
has_many :child_nodes, :class_name => 'Cms::SectionNode'
8-
has_many :child_sections, :class_name => 'Cms::SectionNode', :conditions => ["node_type = ?", "Cms::Section"], :order => "#{SectionNode.table_name}.position"
8+
has_many :child_sections, :class_name => 'Cms::SectionNode', :conditions => ["node_type = ?", "Cms::Section"], :order => "#{Cms::SectionNode.table_name}.position"
99

1010
has_many :pages, :through => :child_nodes, :source => :node, :source_type => 'Cms::Page', :order => "#{Cms::SectionNode.table_name}.position"
1111
has_many :sections, :through => :child_nodes, :source => :node, :source_type => 'Cms::Section', :order => "#{Cms::SectionNode.table_name}.position"

app/models/cms/section_node.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Cms::SectionNode < ActiveRecord::Base
2-
belongs_to :section, :class_name => 'Cms::Section'
3-
belongs_to :node, :polymorphic => :true, :class_name => 'Cms::SectionNode', :foreign_type => 'node_type'
2+
belongs_to :section, :class_name => '::Cms::Section'
3+
belongs_to :node, :polymorphic => :true, :class_name => '::Cms::SectionNode', :foreign_type => 'node_type'
44

55
acts_as_list :scope => :section
66

0 commit comments

Comments
 (0)