Class: CreateMoxieForumTables

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/rails/generators/moxie_forum/templates/migration.rb

Class Method Summary collapse

Class Method Details

.downObject



15
16
17
18
19
# File 'lib/rails/generators/moxie_forum/templates/migration.rb', line 15

def self.down
  drop_table :moxie_forums
  drop_table :moxie_topics
  drop_table :moxie_posts
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
# File 'lib/rails/generators/moxie_forum/templates/migration.rb', line 2

def self.up
  INSERT_SCHEMA
  
  # Seed with some initial data
  
  f = Moxie::Forum.create( :title => "Sample forum", :description => "Description of this forum" )
  t1 = Moxie::Topic.create( :forum => f, :title => "First topic" )
  t2 = Moxie::Topic.create( :forum => f, :title => "Second topic" )
  Moxie::Post.create( :topic => t1, :body => "First post in the first topic" )
  Moxie::Post.create( :topic => t1, :body => "Second post in the first topic" )
  Moxie::Post.create( :topic => t2, :body => "First post in the second topic" )
end