Skip to content
This repository has been archived by the owner on Sep 19, 2019. It is now read-only.

Commit

Permalink
Correcting cable setup to work locally
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeRogers0 committed Sep 14, 2019
1 parent fe92af5 commit d3d6928
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
# gem 'jbuilder', '~> 2.7'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'

Expand Down
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ GEM
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
ffi (~> 1.0)
redis (4.1.2)
regexp_parser (1.6.0)
ruby_dep (1.5.0)
rubyzip (1.2.4)
Expand Down Expand Up @@ -205,6 +206,7 @@ DEPENDENCIES
listen (>= 3.0.5, < 3.2)
puma (~> 3.11)
rails (~> 6.0.0)
redis (~> 4.0)
sass-rails (~> 5)
selenium-webdriver
spring
Expand Down
5 changes: 4 additions & 1 deletion app/javascript/controllers/realtime_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ export default class extends Controller {
// I don't think this is the best approach, I'll lint it in CI.
//this.element.innerHTML = '';
while( this.element.firstChild ) { this.element.removeChild( this.element.firstChild ); }
this.element.appendChild(body);

for (var i = 0; i < body.body.childNodes.length; i++) {
this.element.appendChild(body.body.childNodes[i]);
}
}

}
4 changes: 3 additions & 1 deletion config/cable.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
development:
adapter: async
adapter: redis
url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
channel_prefix: RealtimePartialUpdateApp_development

test:
adapter: test
Expand Down

0 comments on commit d3d6928

Please sign in to comment.