Skip to main content

Group Chat with ActionCable: Part 1 Discussion

General • Asked by Chris Oliver

Great tutorial. Can't wait to see Part 2.


Thanks a lot, Chris, good job, looking forward to the Part II.


Nice job. Look forward to #2.


Awesome! Thanks Chris. Looking forward to the rest of the series.


Can you post the block of modified navbar code that you inserted into application.html.erb? I wasn't able to catch all of it on the screen to see the changes made.

You can find the code for the navbar here: https://github.com/excid3/f...

Thanks! I can't get the username to display in the navbar. The line where you define current_user.short_name throws an undefined error for the 'short_name'. I couldn't find that defined explicitly anywhere else in the program.

It should be current_user.username.

https://github.com/gorails-... You can find the code for the layouts from the episode there.

If you're wondering short_name is probably a method on the user.rb file in the model folder and it's probably setting short_name to whatever the users first name is. But like @ineptsoftware:disqus said, if you change it to current_user.username or current_user.email it should work :)


This was great Chris (edit sorry wrong name lol)! Thanks! I can't wait until you dive into the actual ActionCable. What is the ETA on the second episode?

Just published it! https://gorails.com/episode...

I'll be publishing about one a week so I have time to get through everything.


Chris, don't forget to validate uniqueness of the username.

Thanks! I'll try to make sure I include that.


Hey im new to rails and still getting quite comfortable with Ruby. But I seen that version 5.0 of Rails is out. How do I upgrade/install it? Thanks!!

You can just run "gem install rails" and that should install Rails 5. I'll be doing a screencast on upgrading an existing app to Rails 5 pretty soon.

Hey has this up yet? @excid3:disqus

Hey Ariff,

Haven't recorded that yet, it kinda slipped my mind. Let me get on that this week!


I'm using Monokai in just about all places, vim, zsh, etc.


Hi Chris,
How are you getting those icons like padlock in the text_field?

Those are actually just the LastPass extension trying to save my passwords.

Oh thanks Chris. They make the forms look cool. Will check if it's possible to add them to forms.


Ferran Cabrer i Vilagut

Thanks Chris, I was following building this awesome app, but at (Part-2 at 8:19) I got stuck by this error: Undefined method @chatroom_user = @chatroom.chatroom_users.where(user_id: current_user.id)
How can I fix it in order to continue the app?
Thanks in dvance


Fritz Rodriguez Jr.

Hey Chris! I know I'm late to the party...haha! I found a way of adding custom fields with Devise that I like...

def configure_permitted_parameters
added_attrs = [:username, :email, :password, :password_confirmation, :remember_me]
devise_parameter_sanitizer.permit :sign_up, keys: added_attrs
devise_parameter_sanitizer.permit :account_update, keys: added_attrs
end

This makes it super easier to add additional fields in the future. Anyway, just a quick tip! :)

I like the added_attrs array. It's nice to reuse since I had always just defined the items in each place.


Hello Chris,
thank you for the tutorials. I was wondering if you could make a tutorial for setting up MacVim just like you have? I have tried myself, however, I can not seem to figure out how to do it.

Thanks,

Oh thank you! I just found the video on youtube in the same moment


That devise-bootstrapped gem is a time saver ;)

Credit for that goes to @andrew_fomera:disqus. :D

Thanks for the kind words! If you have any feedback for improvements feel free to hit up the github issues!


Hi, this is a great tutorial so far! However, i'm having some issues near the end. After I add the Devise permitted parameters to the application controller and I try to sign up, I can no longer access the site (even after refreshing and trying to go back to the main page. It gives me a NoMethodError in Chatrooms#index. It says "undefined method `public_channels' for #<activerecord::associations::collectionproxy []="">
Did you mean? public_send" and that the error is from application.html.erb. I replaced my code in that file with yours from the github repo, but i'm still getting the same error. Can someone please point me in the right direction? Thanks!
https://uploads.disquscdn.c...

Hey! I believe that should be just

><% current_user.chatrooms.each do |chatroom| %>

because we didn't build anything called "public_channels" I don't believe.

You can find that line in the github repo here: https://github.com/gorails-...


Hello @excid3:disqus
First of all wonderful tutorial. I have a question, please see if you can help out,

I have a question model and a conversation model, a student asks a question and based on that question a teacher chats with that student. Please note only one teacher and one student are allowed in conversation per question. A student can only ask one question per email address. Now we wanna introduce a live chat support system for our support team to be able to chat with students. Now this chat room should be unique to each question and any number of support users can be present but only one student. How should I go about creating models for chat room based on your tutorial?


weird. I keep on getting this error.

ereks-MacBook-Pro-4:slack.io DerekJLin$ rails s
=> Booting Puma
=> Rails 5.2.1 application starting in development
=> Run `rails server -h` for more startup options
Exiting
/Users/DerekJLin/.rvm/gems/ruby-2.3.3/gems/puma-3.12.0/lib/puma/launcher.rb:343:in `stat': No such file or directory @ rb_file_s_stat - /Users/DerekJLin/slack.io (Errno::ENOENT)
from /Users/DerekJLin/.rvm/gems/ruby-2.3.3/gems/puma-3.12.0/lib/puma/launcher.rb:343:in `generate_restart_data'
from /Users/DerekJLin/.rvm/gems/ruby-2.3.3/gems/puma-3.12.0/lib/puma/launcher.rb:64:in `initialize'
from /Users/DerekJLin/.rvm/gems/ruby-2.3.3/gems/puma-3.12.0/lib/rack/handler/puma.rb:66:in `new'
from /Users/DerekJLin/.rvm/gems/ruby-2.3.3/gems/puma-3.12.0/lib/rack/handler/puma.rb:66:in `run'
from /Users/DerekJLin/.rvm/gems/ruby-2.3.3/gems/rack-2.0.5/lib/rack/server.rb:297:in `start'
from /Users/DerekJLin/.rvm/gems/ruby-2.3.3/gems/railties-5.2.1/lib/rails/commands/server/server_command.rb:53:in `start'
from /Users/DerekJLin/.rvm/gems/ruby-2.3.3/gems/railties-5.2.1/lib/rails/commands/server/server_command.rb:147:in `block in perform'
from /Users/DerekJLin/.rvm/gems/ruby-2.3.3/gems/railties-5.2.1/lib/rails/commands/server/server_command.rb:142:in `tap'
from /Users/DerekJLin/.rvm/gems/ruby-2.3.3/gems/railties-5.2.1/lib/rails/commands/server/server_command.rb:142:in `perform'
from /Users/DerekJLin/.rvm/gems/ruby-2.3.3/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
from /Users/DerekJLin/.rvm/gems/ruby-2.3.3/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
from /Users/DerekJLin/.rvm/gems/ruby-2.3.3/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
from /Users/DerekJLin/.rvm/gems/ruby-2.3.3/gems/railties-5.2.1/lib/rails/command/base.rb:65:in `perform'
from /Users/DerekJLin/.rvm/gems/ruby-2.3.3/gems/railties-5.2.1/lib/rails/command.rb:46:in `invoke'
from /Users/DerekJLin/.rvm/gems/ruby-2.3.3/gems/railties-5.2.1/lib/rails/commands.rb:18:in `<main>'
from /Users/DerekJLin/.rvm/gems/ruby-2.3.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
from /Users/DerekJLin/.rvm/gems/ruby-2.3.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
from /Users/DerekJLin/.rvm/gems/ruby-2.3.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
from /Users/DerekJLin/.rvm/gems/ruby-2.3.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
from /Users/DerekJLin/.rvm/gems/ruby-2.3.3/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
from /Users/DerekJLin/.rvm/gems/ruby-2.3.3/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
from /Users/DerekJLin/.rvm/gems/ruby-2.3.3/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
from /Users/DerekJLin/.rvm/gems/ruby-2.3.3/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
from /Users/DerekJLin/Desktop/slack.io/bin/rails:9:in `<top (required)>'
from /Users/DerekJLin/.rvm/gems/ruby-2.3.3/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
from /Users/DerekJLin/.rvm/gems/ruby-2.3.3/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
from /Users/DerekJLin/.rvm/gems/ruby-2.3.3/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
from /Users/DerekJLin/.rvm/gems/ruby-2.3.3/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
from /Users/DerekJLin/.rvm/gems/ruby-2.3.3/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
from /Users/DerekJLin/.rvm/gems/ruby-2.3.3/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
from /Users/DerekJLin/.rvm/gems/ruby-2.3.3/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
from /Users/DerekJLin/Desktop/slack.io/bin/spring:15:in `require'
from /Users/DerekJLin/Desktop/slack.io/bin/spring:15:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 24,647+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.