Development Data

sarken edited this page Jul 31, 2017 · 1 revision

If you're using Vagrant or a local development environment, you will be starting off with minimal development data. Here are some tips for creating data on your development environment.

Official OTW volunteers wishing to copy their webdev data onto an additional development environment should refer to the page "Copy Webdev Data to Local Install" on the internal wiki.

Creating users

To create and activate a user account, first launch the Rails console:

  bundle exec rails c

Then you can create and activate a user account by entering the following, replacing the values as desired:

  User.new(login: "desired_username", email: "[email protected]", password: "desired_password", password_confirmation: "desired_password", age_over_13: "1", terms_of_service: "1").activate

If you'd like to make it possible to create user accounts through your dev environment's interface, enter the following commands:

  setting = AdminSetting.first
  setting.account_creation_enabled = true
  setting.save

A "Create an Account!" link should now appear on your dev environment's homepage, or you can visit the new user path directly: /users/new.

Creating admins

Creating and logging into an admin account will allow you to perform tasks such as managing user permissions (e.g. make a user a tag wrangler) and modifying your archive's settings through the admin interface.

To create an admin account, run the following script from your command line (not the Rails console) and enter information as prompted:

  bundle exec rails runner script/create_admin.rb

Please note that the "Log In" option at the top of every page will not allow you to log in to an admin account. Instead, go to the admin log in path and use the form presented there: /admin/login.

More information

The Archive of Our Own FAQs may be helpful when creating other types of data through your dev environment's interface.