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
Cells breaks asset precompilation in Rails 3.1.0.rc #51
Comments
Hey cameel, the reason we chose :set_routes_preloader was to make sure routes are available for cells. Not sure if that will work if we change that to :after_initialize. Did you try it already? Would be great ;-) |
Not directly, but the patch in the pull request mentioned above makes Finisher, including :set_routes_preloader, always run last and it does not break cells in my project. I am not sure how to test it more thoroughly though. |
So how does cells' "asset breaking" look like right now? Is there an exception or something like that? |
rake assets:precompile should create public/assets directory and put precompiled JavaScript and CSS there. When Cells is included in Gemfile it does not do this. There is no exception, no errors on the console, nothing. It's because Sprockets' :after_initialize runs when config.assets.paths is not yet initialized and it just thinks that there are no assets. And it's not just rake task. The same goes if you run your Rails application - it should precompile the assets on the first access and this does not happen. |
Related to this: my attempts to get cells working with rails 3.1 (and engines) initially failed until I commented out the line in the cells railtie that deals with initialization after I've submitted this change (removal of the specific |
Hey Mark, you're right, thanks! Not sure why I introduced the options stuff a while ago. Anyway, your fix is applied: 3455518 Thanks man!!! |
Cells in its Railtie wants its initializers to be executed after :set_routes_preloader. I think this is a bad idea since Finisher is expected to run last. Its :finisher_hook executes :after_initialize hooks and many of them assume that initialization has already been performed. While Rails does not prevent you from doing this it was probably not expected - it causes :finisher_hook to be pushed too far down in initialization order and makes asset precompilation fail.
I think that Cells' initializers should be converted into :after_initialization hooks.
See the following links for more details:
Rails issue #1587: after_initialize hooks sometimes get executed during initialization
Rails pull request #1602: Do not TSort Finisher and Bootstrap initializers
The text was updated successfully, but these errors were encountered: