handle destroy layout
This commit is contained in:
		
							parent
							
								
									11991320d2
								
							
						
					
					
						commit
						3d6446041b
					
				| 
						 | 
					@ -6,6 +6,8 @@ class Layout
 | 
				
			||||||
   key :description, String
 | 
					   key :description, String
 | 
				
			||||||
   key_i18n :content, String
 | 
					   key_i18n :content, String
 | 
				
			||||||
   
 | 
					   
 | 
				
			||||||
 | 
					   many :children, :class_name => "Item", :foreign_key => "layout_id", :dependent => :nullify
 | 
				
			||||||
 | 
					   
 | 
				
			||||||
   validates_format_of :name, :with => /^[a-zA-Z-_]+$/
 | 
					   validates_format_of :name, :with => /^[a-zA-Z-_]+$/
 | 
				
			||||||
   
 | 
					   
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
| 
						 | 
					@ -2,7 +2,7 @@ namespace :dev do
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  task :build => :environment do
 | 
					  task :build => :environment do
 | 
				
			||||||
    [Announcement, Item, Snippet, Layout].each { |m| m.delete_all }
 | 
					    [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)
 | 
					                                      :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,
 | 
					      Page.create!( :name => "root", :title => I18n.t(:homepage), :layout_name => "root", :parent_name => nil,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in New Issue