If you are lazy like me and don’t want to go through the signup form again and again, you are at right place.
Export database when you have optimum data in database to use all the features
- In my project I have different users with different roles; like recruiters, managers, supervisor, customer super admin and above all the ‘Super Admin’
- They work on entities like ‘jobs’, ‘Applicants’, ‘Leads’, ‘Organization/user/locations/performances’ (only admins)
- The flow is like,
- Super Admin creates Organization and CSA
- CSA creates
- Users with different roles and assigns Location
- namely(Manager) then
- creates Jobs for that particular locations; jobs belong to locations
- shares/posts jobs to media
- Applicants apply to those jobs and Applicants are created in the system
- Then Recruiters can process the Applicants
There is dependency; you cannot create applicant without fulfilling the prior requirements as described in the tree above.
So, when you have a level of data fulfilling the requirements like tree above (in your context its different) you export the database and save it safe so that whenever you system corrupts or you need to reset the database to test some feature you can restore the database to get back to work.
Create appropriate rake tasks
You can leverage full features of Rake to make your tasks easy. For example:
I have created well documented rake tasks to do some of the tasks like
- Create Organization (Independent task)
- Create Applicant (depends on Job)
- Create Job(depends on location, User)
- Run sidekiq in QA server (EC2 instance) from development environment
- Seeding specific set of data
Note: Dependencies need to be supplied by user via CLI
$ rake applicant:create job_id=5
Why do we need to write ‘
bundle exec rspec spec/‘ or ‘
bundle exec rake db:migrate‘ while ‘
rspec spec/‘ was still running.
Well from help command of Engineyard ruby gem
ey help deploy
we can see that we can send data as key:value pair like
ey deploy -e my_app_staging --config=key:value
I encountered this error when I created a new rails application and tried to bundle the gems.
Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Gem::RemoteFetcher::FetchError: Errno::ECONNREFUSED: Connection refused - connect(2) for "rubygems.org" port 443 (https://rubygems.org/gems/rake-10.4.2.gem)
An error occurred while installing rake (10.4.2), and Bundler cannot
Make sure that `gem install rake -v '10.4.2'` succeeds before bundling
The reason is old rubygems. So we need to remove ssl source to be able to update gem --system which includes rubygems and so on. after this we can feel free to get back to ssl source.
gem sources -r https://rubygems.org/ - to temporarily remove secure connection
gem sources -a http://rubygems.org/ - add insecure connection
gem update --system - now we're able to update rubygems without SSL
after updating rubygems do vice versa
gem sources -r http://rubygems.org/ - to remove insecure connection
gem sources -a https://rubygems.org/ - add secure connection
Now you're able to update gems using secure connection.