How to create the first (Admin) user (CanCan and Devise)?

You can do it from the rails console. From the command line goto the directory of your rails application and type rails console. Then enter the following code to create a user:

user=User.create!(:email=>'[email protected]',:username=>'test',:password=>'password')

This will create a user object (assuming your devise resource is called User). Now you can use the user object that you just created to set admin privileges.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)