Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix of missing initializer at sprockets. #371

Merged
merged 2 commits into from
Dec 2, 2015
Merged

Conversation

vimutter
Copy link

They are using Railtie, so there are no special initializer. I've got 'immutable env' error. Which was fixed by that.

They are using Railtie, so there are no special initializer. I've got 'immutable env' error. Which was fixed by that.
@PikachuEXE
Copy link

Any document that support this change?
I am not an expert for rails initializer and I think most people are not as well.
It will be better for everyone to know what options should be used and why.

@@ -3,7 +3,7 @@
module I18n
module JS
class Engine < ::Rails::Engine
initializer "i18n-js.register_preprocessor", :after => "sprockets.environment" do
initializer "i18n-js.register_preprocessor", after: :engines_blank_point, before: :finisher_hook do
Copy link
Author

Choose a reason for hiding this comment

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

Ok, little bit more details:

  1. Here is where sprockets are attached with Rails. There is no 'sprockets.environment' mentioned.
    https://github.com/rails/sprockets-rails/blob/master/lib/sprockets/railtie.rb
  2. Finisher hook is the place which should be used as border.
    http://guides.rubyonrails.org/configuring.html#initializers

https://github.com/rails/sprockets-rails/blob/master/lib/sprockets/railtie.rb#L160

I.e. we should define preprocessors and such before sprockets finalizes configuration. In our case it was using cached environment.

@vimutter
Copy link
Author

@PikachuEXE Added line comment with more details.

@PikachuEXE
Copy link

I was expecting those to be put in comment, but I can add them afterwards

Also found a solid reference to "sprockets.environment"
rails/sprockets-rails#227

Can you add a change log entry (in bug fixes)?

@vimutter
Copy link
Author

vimutter commented Dec 2, 2015

@PikachuEXE Done, please check.

@PikachuEXE
Copy link

Thanks. Merging.

PikachuEXE added a commit that referenced this pull request Dec 2, 2015
Fix of missing initializer at sprockets.
@PikachuEXE PikachuEXE merged commit 22d464f into fnando:master Dec 2, 2015
gabealmer added a commit to gabealmer/i18n-js that referenced this pull request Mar 2, 2016
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants