An issue with cable.js after rails 4.2.2 - 5.0.0.1 update

39 views
Skip to first unread message

krfg

unread,
Aug 19, 2016, 7:24:00 AM8/19/16
to Ruby on Rails: Talk
I upgraded a copy of my rails 4.2.2 application to rails 5.0.0.1, following instructions at railsapp and at edgeguides.rubyonrails.org
Most of my work consisted in consulting railsdiff.org, thus copying and pasting new code to my application.

After completing all the necessary revisions and running tests, I was warned about some issues.
Line 6 of app/assets/javascripts/cable.js (copied from railsdiff.org) raises an error (channels should be a directory).

According to Rails 4.2.2 - 5.0.0.1 diff the only channels directory is in app


So line 6, instead of

//= require_tree ./channels


I can only suppose should be

//= require_tree ../../channels


However I am not sure about this.

I wondering if anyone of you knows about what channels directory line 6 of cable.js is referring to.


Also, according to Cloud9 editor, ActionCable in app/assets/javascripts/cable.js results not defined: ActionCable is not defined; please fix or add /*global ActionCable*/


Did railsdiff.org/4.2.2/5.0.0.1 miss anything, like a channels directory in app/assets/javascripts or the definition somewhere of an ActionCable class?


Hassan Schroeder

unread,
Aug 19, 2016, 9:56:32 AM8/19/16
to rubyonrails-talk
On Fri, Aug 19, 2016 at 4:24 AM, 'krfg' via Ruby on Rails: Talk
<rubyonra...@googlegroups.com> wrote:
> I upgraded a copy of my rails 4.2.2 application to rails 5.0.0.1, following
> instructions at railsapp and at edgeguides.rubyonrails.org
> Most of my work consisted in consulting railsdiff.org, thus copying and
> pasting new code to my application.
>
> After completing all the necessary revisions and running tests, I was warned
> about some issues.
> Line 6 of app/assets/javascripts/cable.js (copied from railsdiff.org) raises
> an error (channels should be a directory).
>
> According to Rails 4.2.2 - 5.0.0.1 diff the only channels directory is in
> app
>
>
> So line 6, instead of
>
> //= require_tree ./channels
>
>
> I can only suppose should be
>
> //= require_tree ../../channels

No.

If you generate a new Rails 5 app you'll see the directory in question
at app/assets/javascripts/channels.

Aside, I highly recommend `generate a new app` as an approach to
learning what's changed in any major update.

Generate it with the defaults, check in to git, check out a branch and
scaffold a channel or whatever - your git history now shows you what
got added/changed/deleted. And you have an example to compare
your upgraded app against.

FWIW,
--
Hassan Schroeder ------------------------ hassan.s...@gmail.com
http://about.me/hassanschroeder
twitter: @hassan
Consulting Availability : Silicon Valley or remote

krfg

unread,
Aug 19, 2016, 11:15:04 AM8/19/16
to Ruby on Rails: Talk
Thanks.
Plainly railsdiff.org does not consider and report empty directories.
I found two of them:

app/assets/javascripts/channels/
test/fixtures/files/

with an hidden, empty .keep file inside each one

They are not in rails 4.2.2

Reply all
Reply to author
Forward
0 new messages