Sha256: 38fb953f55abf266b13b54998af1c5fea720078799bbb0d08e82af1b4bab8267

Contents?: true

Size: 889 Bytes

Versions: 5

Compression:

Stored size: 889 Bytes

Contents

# Application template recipe for the rails3_devise_wizard. Check for a newer version here:
# https://github.com/fortuity/rails3_devise_wizard/blob/master/recipes/seed_database.rb


after_bundler do

  if recipes.include? 'devise'

    if recipes.include? 'mongoid'
      # create a default user
      append_file 'db/seeds.rb' do <<-FILE
puts 'EMPTY THE MONGODB DATABASE'
Mongoid.master.collections.reject { |c| c.name =~ /^system/}.each(&:drop)
puts 'SETTING UP DEFAULT USER LOGIN'
user = User.create! :name => 'First User', :email => 'user@test.com', :password => 'please', :password_confirmation => 'please'
puts 'New user created: ' << user.name
FILE
      end
    end

    run 'rake db:seed'

  end

end

__END__

name: SeedDatabase
description: "Create a database seed file with a default user."
author: fortuity

requires: [devise]
category: other
tags: [utilities, configuration]

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rails3_devise_wizard-0.2.4 recipes/seed_database.rb
rails3_devise_wizard-0.2.3 recipes/seed_database.rb
rails3_devise_wizard-0.2.2 recipes/seed_database.rb
rails3_devise_wizard-0.2.1 recipes/seed_database.rb
rails3_devise_wizard-0.2 recipes/seed_database.rb