-
-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to specify parent class for active record #238
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ module GoodJob | |
# | ||
# Represents a request to perform an +ActiveJob+ job. | ||
# | ||
class Job < ActiveRecord::Base | ||
class Job < Object.const_get(GoodJob.active_record_parent_class) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
include Lockable | ||
|
||
# Raised if something attempts to execute a previously completed Job again. | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -143,7 +143,7 @@ def with_advisory_lock | |||||
def supports_cte_materialization_specifiers? | ||||||
return @_supports_cte_materialization_specifiers if defined?(@_supports_cte_materialization_specifiers) | ||||||
|
||||||
@_supports_cte_materialization_specifiers = ActiveRecord::Base.connection.postgresql_version >= 120000 | ||||||
@_supports_cte_materialization_specifiers = Job.connection.postgresql_version >= 120000 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm, this doesn't work somehow There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Whoops. This is within |
||||||
end | ||||||
end | ||||||
|
||||||
|
@@ -158,7 +158,7 @@ def advisory_lock | |||||
WHERE pg_try_advisory_lock(('x'||substr(md5($1 || $2::text), 1, 16))::bit(64)::bigint) | ||||||
SQL | ||||||
binds = [[nil, self.class.table_name], [nil, send(self.class.primary_key)]] | ||||||
ActiveRecord::Base.connection.exec_query(pg_or_jdbc_query(query), 'GoodJob::Lockable Advisory Lock', binds).any? | ||||||
Job.connection.exec_query(pg_or_jdbc_query(query), 'GoodJob::Lockable Advisory Lock', binds).any? | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here:
Suggested change
|
||||||
end | ||||||
|
||||||
# Releases an advisory lock on this record if it is locked by this database | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.