I am looking for a way to seed my Rails Application with Users.
The catch is that I am only using omniauth for login.
The reason I want to do this is I want to create the first user as an admin, and the best way I see is to do this via a rake db:seed.
I am aware of how to do the test with FactoryGirl and I was wondering if it would be possible by setting the
OmniAuth.config.test_mode = false
Then somehow run the ‘auth/provider’ route, but I would like to know if this can be automated? Perhaps using Nokogiri with Mechanize to follow the URL and automate the process like here Mecanize Railscast.
It all seems like a lot of code for 1 user seed 🙂 I am not asking for someone to do this for me, but whether there is a simpler method that hasn’t occurred to me.
I appreciate anyone who takes the time to read this and even more so takes the time to respond.
The way I will handle this is to push the code to the production server, set my omniauth app settings to my production URL, authenticate the Admin user, return the the omniauth to Yaml as in the tutorial on Rails App Project. I will then use this information to seed my database once the application is complete.
A bit of a workaround, but much quicker than my earlier ideas 🙂