handle destroy layout

This commit is contained in:
Wen-Tien Chang 2010-02-05 16:59:41 +08:00
parent 11991320d2
commit 3d6446041b
2 changed files with 3 additions and 1 deletions

View File

@ -6,6 +6,8 @@ class Layout
key :description, String
key_i18n :content, String
many :children, :class_name => "Item", :foreign_key => "layout_id", :dependent => :nullify
validates_format_of :name, :with => /^[a-zA-Z-_]+$/
end

View File

@ -2,7 +2,7 @@ namespace :dev do
task :build => :environment do
[Announcement, Item, Snippet, Layout].each { |m| m.delete_all }
Layout.create!( :name => 'root', :content_zh_tw => File.open("#{RAILS_ROOT}/lib/template/root.layout.zh_tw").read,
Layout.create!( :name => 'root', :description => 'root', :content_zh_tw => File.open("#{RAILS_ROOT}/lib/template/root.layout.zh_tw").read,
:content_en => File.open("#{RAILS_ROOT}/lib/template/root.layout.en").read)
Page.create!( :name => "root", :title => I18n.t(:homepage), :layout_name => "root", :parent_name => nil,