Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails 6 Upgrade Part X: template & sources not template.source #2

Merged
merged 2 commits into from May 20, 2021

Conversation

ebinmore
Copy link
Collaborator

@ebinmore ebinmore commented May 20, 2021

The Story So Far

We have been trying to upgrade sbn to Rails 6. On the last attempt, we were seeing a template error. Here it is:

SENTRY ERROR

ActionView::Template::Error

undefined method `_app_unison_cells_unison_entry_post_head_html_erb__1347066537634862207_26377380' for #<#<Class:0x00000000046d3338>:0x00000000046fa5a0>
Did you mean?  _app_unison_cells_unison_entry_page_display_html_erb___2077844904212712566_37183300

NoMethodError

undefined method `_app_unison_cells_unison_entry_post_head_html_erb__1347066537634862207_26377380' for #<#<Class:0x00000000046d3338>:0x00000000046fa5a0>
Did you mean?  _app_unison_cells_unison_entry_page_display_html_erb___2077844904212712566_37183300

I haven't been able to find anything the specifically references this problem when upgrading to Rails 6, but there is a deprecation warning about ActionView::Template when starting up sbn on the rails-6 branch. No definitive answers, but close. Here's the

DEPRECATION WARNING

馃 docker attach sbn_app_1
warning Your current version of Yarn is out of date. The latest version is "1.22.5", while you're on "1.22.4".
=> Booting Unicorn
=> Rails 6.0.3.7 application starting in development http://0.0.0.0:3000
=> Run `rails server --help` for more startup options
DEPRECATION WARNING: Single arity template handlers are deprecated. Template handlers must
now accept two parameters, the view object and the source for the view object.
Change:
  >> #<ActionView::Template::Handlers::RJS:0x00000000085619d8>.call(template)
To:
  >> #<ActionView::Template::Handlers::RJS:0x00000000085619d8>.call(template, source)

Purpose

So, I'm trying to resolve the DEPRECATION WARNING with this PR.

I got here by reading a github issue and looked at the related pull request. I've link to those here, but it was mostly find the place to make the change suggested. It was all in the DEPRECATION WARNING message, but I had to decipher / read it.

Changes

  • update the signature of the prototype-rails/lib/action_view/template/handlers/rjs.rb that maps to ActionView::Template::Handlers::RJS.call to call(template, source).
  • update the body to use source instead of template.source - this seems like a reasonable thing to do.

Strangeness

  • I noticed that this Gemfile.lock has been pegged at Rails 6.1.1, which is higher than sbn which is at 6.0.3.7.

OUTCOME

Merging this, which will roll the version of the gem to 4.2.0, will update sbn gemfile to use new version.

@ebinmore ebinmore merged commit 740f701 into master May 20, 2021
@ebinmore ebinmore deleted the eb-rails-6-upgrade branch May 20, 2021 21:38
@ebinmore
Copy link
Collaborator Author

To add a tag, I had to:

ericbinmore at errorbook-pro in ~/Projects/prototype-rails on master
馃 git tag -a v4.2.0 -m 'Rails 6 update'

Then push it to origin, but you need to be explicit and push the tag:

ericbinmore at errorbook-pro in ~/Projects/prototype-rails on master
馃 git push origin v4.2.0
Enumerating objects: 1, done.
Counting objects: 100% (1/1), done.
Writing objects: 100% (1/1), 172 bytes | 172.00 KiB/s, done.
Total 1 (delta 0), reused 0 (delta 0)
To github.com:voxmedia/prototype-rails.git
 * [new tag]         v4.2.0 -> v4.2.0

Now, I should be able to update sbn to use v4.2.0.

@ebinmore ebinmore changed the title Rails 6 Upgrade Part X: template & sources not template.source` Rails 6 Upgrade Part X: template & sources not template.source May 20, 2021
@ebinmore ebinmore self-assigned this Oct 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant