|
9f3b911b
»
|
learningrails-test |
2008-08-31 |
Data migration to initializ... |
1 |
class DefaultPages < ActiveRecord::Migration |
| |
2 |
def self.up |
| |
3 |
if Page.find(:all).empty? |
| |
4 |
Page.create(:name => 'home', :title => 'Learning Rails Sample Application Home', :navlabel => 'Home', :position => 1, |
| |
5 |
:admin => false, :redirect => false, |
| |
6 |
:body => 'h1. Welcome to the Learning Rails Sample Application') |
| |
7 |
about_page = Page.create(:name => 'about', :title => 'About the Learning Rails Sample Application', :navlabel => 'About', :position => 2, |
| |
8 |
:admin => false, :redirect => false, |
| |
9 |
:body => 'h1. About This Application |
| |
10 |
|
| |
11 |
p. This is the sample application for the "Learning Rails" free online course. |
| |
12 |
For more information, see "LearningRails.com":http://learningrails.com') |
| |
13 |
Page.create(:name => 'resources', :title => 'Learning Rails Resources', :navlabel => 'Resources', :position => 3, |
| |
14 |
:admin => false, :redirect => true, |
| |
15 |
:action_name => 'list', :controller_name => 'links') |
| |
16 |
Page.create(:name => 'contact', :title => 'Contact Us', :navlabel => 'Contact', :position => 4, |
| |
17 |
:admin => false, :redirect => true, |
| |
18 |
:action_name => 'new', :controller_name => 'messages') |
| |
19 |
Page.create(:name => 'admin', :title => 'Sample App Administration', :navlabel => 'Admin', :position => 9, |
| |
20 |
:admin => true, :redirect => false, |
| |
21 |
:body => 'h1. Admin Dashboard |
| |
22 |
|
| |
23 |
p. "Page Admin":/pages |
| |
24 |
|
| |
25 |
p. "User Admin":/users |
| |
26 |
|
| |
27 |
p. "Category Admin":/categories |
| |
28 |
|
| |
29 |
p. "Link Admin":/links |
| |
30 |
|
| |
31 |
p. "Message Admin":/messages') |
| |
32 |
Page.create(:name => 'services', :title => 'Services', :navlabel => 'Services', :position => 1, |
| |
33 |
:admin => false, :redirect => false, :parent => about_page, |
| |
34 |
:body => 'h1. Services |
| |
35 |
|
| |
36 |
p. This page is here just to illustrate a subpage') |
| |
37 |
Page.create(:name => 'products', :title => 'Products', :navlabel => 'Products', :position => 2, |
| |
38 |
:admin => false, :redirect => false, :parent => about_page, |
| |
39 |
:body => 'h1. Products |
| |
40 |
|
| |
41 |
p. This page is here just to illustrate a subpage') |
| |
42 |
end |
| |
43 |
if Category.find(:all).empty? |
| |
44 |
rails_resources = Category.create(:title => 'Rails Resources', :description => 'Resources for Rails Developers') |
| |
45 |
html_resources = Category.create(:title => 'HTML Resources', :description => 'Basic HTML Resources') |
| |
46 |
Link.create(:url => 'http://www.buildingwebapps.com', :title => 'BuildingWebApps.com', :description => 'Resource site for |
| |
47 |
web application developers, created by the authors of the Learning Rails course').categories << rails_resources |
| |
48 |
Link.create(:url => 'http://w3c.org', :title => 'W3C', :description => 'Official standards body for the web').categories << html_resources |
| |
49 |
end |
| |
50 |
end |
| |
51 |
|
| |
52 |
def self.down |
| |
53 |
end |
| |
54 |
end |