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
Upgrade to Rails 5.1.1 #1912
Upgrade to Rails 5.1.1 #1912
Conversation
config/initializers/assets.rb
Outdated
@@ -9,8 +9,3 @@ | |||
# Add additional assets to the asset load path | |||
# Rails.application.config.assets.paths << Emoji.images_path | |||
|
|||
# Precompile additional assets (application.js.coffee.erb, application.css, and all non-JS/CSS are already added) | |||
Rails.application.config.assets.precompile += %w( diagram.js graphing.js map_marker.js ace.js ) |
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.
Does it automatically infer these from our requiring them or something?
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.
sprocket-rails
now requires a manifest.js file which is used as a configuration which assets should be precompiled.
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.
Ah, ok, I see that you added that. But how does it know to generate diagram.js
, graphing.js
, map_marker.js
, ace.js
, etc. as final output packages so that they can be served? We link them directly, e.g. https://github.com/cantino/huginn/blob/5868c7b4b23516bce7f7a9867b2310d6ef85980b/app/views/agents/agent_views/user_location_agent/_show.html.erb#L3
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.
Yeah ... that is a good question I don't know the answer to. I suspected that it would not work with additional configuration, but somehow it does:
root@38d92fad1b9d:/app# ls -al public/assets/*.js
-rw-r--r-- 1 root root 803641 Feb 24 19:06 public/assets/ace-b7a9a36a7e16893758aa7910f8b51810fb1673b0a7f8b5495c369cfddf6751e7.js
-rw-r--r-- 1 root root 432321 Feb 24 21:08 public/assets/ace-edaac82bab5f8f31f17d02dac1f82c356dab951ea95e48d977a9b0022a5b263c.js
-rw-r--r-- 1 root root 301207 Feb 24 21:08 public/assets/application-af5d3ed2164b4c06a6ab10e891ff4e4cc24e3b8227e3c9b45b0190220f5c31ae.js
-rw-r--r-- 1 root root 759678 Feb 24 19:06 public/assets/application-b53519a18e5154acfef3f481b6eb549f433c297ce5b5d20ff4f9c0e80a3e9a13.js
-rw-r--r-- 1 root root 613 Feb 24 21:08 public/assets/diagram-778f361aa4ed8e87fe51c63d2c61bde329dbf89fc57f31a3f044ec3f2e9154b5.js
-rw-r--r-- 1 root root 987 Feb 24 19:06 public/assets/diagram-8c003dba8f5583de4723c10c9633cbca33de071949984908797f6d478cc0e819.js
-rw-r--r-- 1 root root 166668 Feb 24 21:08 public/assets/graphing-141c9aa5934e3446123bf8e6b735e9d731fa2c9c803ef997c5a73ad72ad090ea.js
-rw-r--r-- 1 root root 333654 Feb 24 19:06 public/assets/graphing-5aa056a62d2dc93d05c4bd2f3d9c63395659962a7b923debb11d4b0d942fb8f5.js
-rw-r--r-- 1 root root 0 Feb 24 21:08 public/assets/manifest-d0ff5974b6aa52cf562bea5921840c032a860a91a3512f7fe8f768f6bbe005f6.js
-rw-r--r-- 1 root root 3 Feb 24 19:06 public/assets/manifest-e761884522a9ca2dac475b68bac1946c990fb9af8b676d3b6b45692a920c8d04.js
-rw-r--r-- 1 root root 1350 Feb 24 19:06 public/assets/map_marker-06756fac4a853bdcde5557d1f2e0d5333441903cf97ec1e75414e5871cc1af22.js
-rw-r--r-- 1 root root 356 Feb 24 21:08 public/assets/map_marker-d4e91cde532b7818afd0e878e3acc4f49e84af9e006976b5abfb08b5a865c549.js
My guess is the rules defined in manifest.js
mean that every file in app/assets/javascript
gets precompile into a separate js bundle
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.
I guess that must be what's happening, and application.js.coffee does it's own bundling of components/*
and pages/*
.
This is now ready for manual testing, since we plugged a lot of holes in our test suite with/after the Rails 5.0 so I don't expect any issues. I would like to wait for an official @knu Does Rails 5.1 solve the issues you had left with adding support for Ruby 2.4? |
I would consider this ready for testing/review now. The branch is running on my instance for a few weeks without issues and |
@dsander I've just updated my |
@knu It would be great if you could test this branch on your instance for a day or two. Our controller spec coverage is pretty good, but I don't use that many Agents (even though I don't think the Rails broke any Agent related code). |
Ah, and yes I think we should merge this PR first to check if they fixed all the deprecation warnings. |
@dsander Just upgraded my instance which now bases on this PR. I'll see how it works. |
@dsander Looks like it is working without a problem. |
Gemfile.lock
Outdated
mini_portile2 (~> 2.1.0) | ||
nokogiri (1.7.2) |
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.
This line looks suspicious. Maybe a merge mistake?
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.
You are right, mini_portile2
is a nokogiri dependency 😄 I am surprised bundler did not complain about it or fix the Gemfile.lock
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.
@dsander Great work! Please check the comment for a suspicious change in Gemfile.lock.
has_many :links_as_source, :dependent => :delete_all, :foreign_key => "source_id", :class_name => "Link", :inverse_of => :source | ||
has_many :links_as_receiver, :dependent => :delete_all, :foreign_key => "receiver_id", :class_name => "Link", :inverse_of => :receiver | ||
has_many :sources, :through => :links_as_receiver, :class_name => "Agent", :inverse_of => :receivers | ||
has_many :received_events, -> { order("events.id desc") }, :through => :sources, :class_name => "Event", :source => :events |
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.
Is this just a cosmetic change? It's OK if that's the case, I'm just curious whether the order matters now in Rails 5.1.
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.
Rails 5.1 complains when a has_many :through
association is defined to before the through
association is defined. That's why it had to be moved after the definition of sources
rails/rails@f8ab3ae
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.
That makes sense. I'll keep it in mind, thanks.
Use `to_unsafe_h` to convert unpermitted parameters to a Hash Specify rails version in migrations
In Rails 5.1 transactional tests share the same connection id between the webserver and test runner. This removes the need for special cleanup strategies. This speeds up the tests significantly, before: ``` Finished in 3 minutes 30.3 seconds (files took 5.46 seconds to load) ``` After: ``` Finished in 1 minute 41.61 seconds (files took 5.45 seconds to load) ``` rails/rails#28083
By passing an empty hash to `permit` strong parameters permits the complete hash. rails/rails@e86524c Refactor ApplicationController#agent_params
Thanks for testing an reviewing this @knu! |
Nice! |
Currently using 5.1.1, the update was done with the help of railsdiff as usual.
I did some additional manual testing and did not find any issues.