diff options
author | Cristian Bica <cristian.bica@gmail.com> | 2014-08-13 23:05:21 +0300 |
---|---|---|
committer | Cristian Bica <cristian.bica@gmail.com> | 2014-08-13 23:05:21 +0300 |
commit | b6496713e9fb2e5e34716662087418931564646b (patch) | |
tree | e5478fa3d239b8b7f83dc6334840bf984c5c0851 | |
parent | 06908e60be2bd3e2f247e26d3d1fa6bcb7f43943 (diff) | |
download | rails-b6496713e9fb2e5e34716662087418931564646b.tar.gz rails-b6496713e9fb2e5e34716662087418931564646b.tar.bz2 rails-b6496713e9fb2e5e34716662087418931564646b.zip |
Update ActiveJob guide [ci skip]
-rw-r--r-- | guides/source/active_job_basics.md | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/guides/source/active_job_basics.md b/guides/source/active_job_basics.md index 7b281bfab2..4442753370 100644 --- a/guides/source/active_job_basics.md +++ b/guides/source/active_job_basics.md @@ -39,15 +39,25 @@ This section will provide a step-by-step guide to creating a job and enqueue it. ### Create the Job +Active Job provides a Rails generator to create jobs. The following will create a +job in app/jobs: + ```bash $ bin/rails generate job guests_cleanup create app/jobs/guests_cleanup_job.rb ``` +You can also create a job that will run on a specific queue: + +```bash +$ bin/rails generate job guests_cleanup --queue urgent +create app/jobs/guests_cleanup_job.rb +``` + As you can see, you can generate jobs just like you use other generators with Rails. -If you didn't want to use a generator, you could create your own file inside of +If you don't want to use a generator, you could create your own file inside of app/jobs, just make sure that it inherits from `ActiveJob::Base`. Here's how a job looks like: @@ -209,8 +219,7 @@ Active Job has adapters for the following queueing backends: ### Change Backends -You can easy change your adapter in your application.rb or development.rb or production.rb -or in an initializer: +You can easy change your adapter: ```ruby # be sure to have the adapter gem in your Gemfile and follow the adapter specific |