Skip to content

Commit 5c4db3c

Browse files
committed
document the new rails integration
1 parent 9ecae74 commit 5c4db3c

File tree

1 file changed

+7
-20
lines changed

1 file changed

+7
-20
lines changed

readme.md

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -132,35 +132,22 @@ source "http://rubygems.org"
132132
gem "queue_classic", "2.2.0"
133133
```
134134

135-
Require these files in your Rakefile so that you can run `rake qc:work`.
136-
137-
```ruby
138-
require "queue_classic"
139-
require "queue_classic/tasks"
140-
```
141-
142135
By default, queue_classic will use the QC_DATABASE_URL falling back on DATABASE_URL. The URL must be in the following format: `postgres://username:password@localhost/database_name`. If you use Heroku's PostgreSQL service, this will already be set. If you don't want to set this variable, you can set the connection in an initializer. **QueueClassic will maintain its own connection to the database.** This may double the number of connections to your database. Set QC::Conn.connection to share the connection between Rails & QueueClassic
143136

144137
```ruby
145138
require 'queue_classic'
146139
QC::Conn.connection = ActiveRecord::Base.connection.raw_connection
147140
```
148141

149-
**Note on using ActiveRecord migrations:** If you use the migration, and you wish to use commands that reset the database from the stored schema (e.g. `rake db:reset`), your application must be configured with `config.active_record.schema_format = :sql` in `config/application.rb`. If you don't do this, the PL/pgSQL function that queue_classic creates will be lost when you reset the database.
142+
Next you need to run the queue classic generator to create the database
143+
migration. This will setup the necessary table to use queue classic.
150144

151-
```ruby
152-
require 'queue_classic'
153-
154-
class AddQueueClassic < ActiveRecord::Migration
155-
def self.up
156-
QC::Setup.create
157-
end
158-
159-
def self.down
160-
QC::Setup.drop
161-
end
162-
end
163145
```
146+
rails generate queue_classic:install
147+
rake db:migrate
148+
```
149+
150+
**Note on using ActiveRecord migrations:** If you use the migration, and you wish to use commands that reset the database from the stored schema (e.g. `rake db:reset`), your application must be configured with `config.active_record.schema_format = :sql` in `config/application.rb`. If you don't do this, the PL/pgSQL function that queue_classic creates will be lost when you reset the database.
164151

165152
### Rake Task Setup
166153

0 commit comments

Comments
 (0)