Changeset 718

Show
Ignore:
Timestamp:
02/01/08 18:48:46 (6 months ago)
Author:
mislav
Message:

cleanup up the underscore layout hack by using method chain

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/rails2/app/models/page.rb

    r715 r718  
    1111  acts_as_tree :order => 'virtual DESC, title ASC' 
    1212  has_many :parts, :class_name => 'PagePart', :order => 'id', :dependent => :destroy 
    13   belongs_to :_layout, :class_name => 'Layout', :foreign_key => 'layout_id' 
     13  belongs_to :layout 
    1414  belongs_to :created_by, :class_name => 'User', :foreign_key => 'created_by' 
    1515  belongs_to :updated_by, :class_name => 'User', :foreign_key => 'updated_by' 
     
    3737  set_inheritance_column :class_name 
    3838   
    39   def layout 
    40     unless _layout 
     39  def layout_with_inheritance 
     40    unless layout_without_inheritance 
    4141      parent.layout if parent? 
    4242    else 
    43       _layout 
    44     end 
    45   end 
     43      layout_without_inheritance 
     44    end 
     45  end 
     46  alias_method_chain :layout, :inheritance 
    4647   
    4748  def cache?