32 lines
950 B
Ruby
32 lines
950 B
Ruby
# This file should contain all the record creation needed to seed the database with its default values.
|
|
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
|
#
|
|
# Examples:
|
|
#
|
|
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
|
|
# Mayor.create(:name => 'Daley', :city => cities.first)
|
|
|
|
['registered', 'banned', 'moderator', 'admin'].each do |role|
|
|
Role.find_or_create_by_name role
|
|
end
|
|
|
|
User.create!(
|
|
[
|
|
{ :username => "admin", :email => "admin@forum.com", :password => "forum_admin", :password_confirmation => "forum_admin", :is_admin => true, :role => Role.find_by_name('admin') },
|
|
]
|
|
)
|
|
|
|
Category.create!(
|
|
[
|
|
{ :title => "General Discussion", :position => 0 },
|
|
]
|
|
)
|
|
|
|
Forum.create!(
|
|
[
|
|
{ :title => "General Discussion", :description => "Discuss any topic in this forum.", :category_id => Category.find_by_title("General Discussion").id, :position => 0 },
|
|
]
|
|
)
|
|
|
|
|