Skip to content

Default config.assets.digests to true in development#15155

Merged
rafaelfranca merged 1 commit into
rails:masterfrom
namuorg:digest
May 19, 2014
Merged

Default config.assets.digests to true in development#15155
rafaelfranca merged 1 commit into
rails:masterfrom
namuorg:digest

Conversation

@namuorg

@namuorg namuorg commented May 17, 2014

Copy link
Copy Markdown

With rails/sprockets-rails#149, assets will only be served if the request has a digest if config.assets.digest = true and config.assets.raise_runtime_errors = true.

This PR sets config.assets.digest to true by default and will help users avoid hardcoding paths that work in development but break in production.

@rafaelfranca

Copy link
Copy Markdown
Member

Cool! Change the Gemfile to point to sprockets-rails master and we run the test suite against it.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer results in false positives thanks to rails/sprockets-rails#84.

@namuorg

namuorg commented May 17, 2014

Copy link
Copy Markdown
Author

Done!

@namuorg

namuorg commented May 17, 2014

Copy link
Copy Markdown
Author

From a quick glance at the CI failures, it seems like there are instances in the tests that request assets without their digests and some asserts that expect the non-digested URL (e.g. expecting /src='\/\/example\.com\/assets\/rails\.png'/ when actual is "var src='//example.com/assets/rails-495b94d9cdd18b3a6eba96326cd909de.png';\n")

I'll take a look at turning off the digest flag when appropriate for some of the tests and amending the regex to include a digest for others.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to disable digest for this case?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, we need to disable it. We make a GET to "/assets/demo.js" which doesn't work when digests are enabled since a digest isn't included in the request URL.

@rafaelfranca

Copy link
Copy Markdown
Member

Could you add a CHANGELOG entry?

@namuorg

namuorg commented May 19, 2014

Copy link
Copy Markdown
Author

Sure. Do you mean another CHANGELOG entry in addition to the one already added to railties/CHANGELOG.md?

@rafaelfranca

Copy link
Copy Markdown
Member

Oops, it is there already. thanks.

rafaelfranca added a commit that referenced this pull request May 19, 2014
Default config.assets.digests to true in development
@rafaelfranca rafaelfranca merged commit 09cc922 into rails:master May 19, 2014
@namuorg

namuorg commented May 19, 2014

Copy link
Copy Markdown
Author

Thanks @rafaelfranca and @matthewd for your help in getting this and rails/sprockets-rails#149 done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants