public
Fork of halorgium/mephisto
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/technoweenie/mephisto.git
Click here to lend your support to: mephisto and make a donation at www.pledgie.com !
yaroslav (author)
Sun May 11 04:06:30 -0700 2008
commit  33a730791242bb12b2bcd8cfab0a59e2b750b725
tree    1d883f402575865a5d3bf8ea2cbf9a920812966a
parent  bc58c2c800ee1bb8e33b4054e8565ce7e19ee8fa
mephisto / db / migrate / 013_add_section_attributes.rb
100644 34 lines (29 sloc) 0.852 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
class AddSectionAttributes < ActiveRecord::Migration
  class Template < ActiveRecord::Base
    set_table_name 'attachments'
  end
  
  def self.up
    add_column :sections, :articles_per_page, :integer, :default => 15
    add_column :sections, :layout, :string
    add_column :sections, :template, :string
 
    Section.transaction do
      Section.find(:all).each do |section|
        section.articles_per_page = 15
        section.save!
      end
    end
    
    Template.transaction do
      Template.find(:all).each do |template|
        if template.filename == 'layout'
          template[:type] = 'LayoutTemplate'
          template.save!
        end
      end
    end
  end
 
  def self.down
    remove_column :sections, :articles_per_page
    remove_column :sections, :layout
    remove_column :sections, :template
  end
end