Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## 005_add_default_admin.rb
- class AddDefaultAdmin < ActiveRecord::Migration
- def self.up
- user = User.new
- user.login = "evan"
- user.email = "evan.alter@gmail.com"
- user.password = "test"
- user.password_confirmation = "test"
- location = Location.new(:zipcode => "78704", :name => "Default")
- user.locations << location
- user.default_location = location
- user.locations
- user.profile = Profile.new
- user.roles << Role.find_by_name('admin')
- user.save(false)
- user.activate!
- end
- def self.down
- user = User.find_by_login('evan')
- user.default_location.destory
- user.profile.destroy
- user.roles.destory
- user.destory
- end
- end
Add Comment
Please, Sign In to add comment