collectiveidea/delayed_job_active_record

Syntax error (unterminated string) when using delayed_job 4.1.3

danascheider opened this issue · 1 comments

Hello, we just updated the delayed_job gem to v. 4.1.3 in our Travis build and began encountering failures with the following error trace (using delayed_job_active_record 4.1.2):

/Users/dscheider/.rvm/gems/ruby-2.3.4@ruby_agent/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:251:in `require': /Users/dscheider/.rvm/gems/ruby-2.3.4@ruby_agent/gems/delayed_job_active_record-4.1.2/lib/generators/delayed_job/templates/migration.rb:1: unterminated string meets end of file (SyntaxError)
/Users/dscheider/.rvm/gems/ruby-2.3.4@ruby_agent/gems/delayed_job_active_record-4.1.2/lib/generators/delayed_job/templates/migration.rb:1: syntax error, unexpected end-of-input, expecting ';' or '\n'
	from /Users/dscheider/.rvm/gems/ruby-2.3.4@ruby_agent/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:251:in `block in require'
	from /Users/dscheider/.rvm/gems/ruby-2.3.4@ruby_agent/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:236:in `load_dependency'
	from /Users/dscheider/.rvm/gems/ruby-2.3.4@ruby_agent/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:251:in `require'

When I look at the offending file, I see the following code:

class CreateDelayedJobs < ActiveRecord::Migration<%= migration_version %>
  ...
end

As you can see, there's an attempt to interpolate a migration version using ERB that is apparently not working as planned with the new version of delayed_job. The problem goes away when I use delayed_job_active_record 4.1.1.

I would be able to look into this issue further on Monday, but first wanted to ask whether you are already working on a fix, do not intend to fix this issue, or have insights into it that I may have missed. Thanks!

That file is a migration template. It is no longer able to be required directly and was never intended to be. You need to find out what is trying to require that file and not do that.