├── .gitignore ├── .ruby-version ├── Gemfile ├── Gemfile.lock ├── README.md ├── Rakefile ├── app ├── assets │ ├── images │ │ └── .keep │ ├── javascripts │ │ ├── application.js │ │ └── channels │ │ │ ├── comments.coffee │ │ │ └── index.coffee │ └── stylesheets │ │ ├── application.css │ │ └── examples.scss ├── channels │ ├── application_cable │ │ ├── channel.rb │ │ └── connection.rb │ └── comments_channel.rb ├── controllers │ ├── application_controller.rb │ ├── comments_controller.rb │ ├── concerns │ │ ├── .keep │ │ └── authentication.rb │ ├── examples_controller.rb │ ├── messages_controller.rb │ └── sessions_controller.rb ├── helpers │ └── application_helper.rb ├── jobs │ ├── application_job.rb │ └── comment_relay_job.rb ├── mailers │ └── .keep ├── models │ ├── .keep │ ├── comment.rb │ ├── concerns │ │ └── .keep │ ├── message.rb │ └── user.rb └── views │ ├── comments │ ├── _comment.html.erb │ ├── _comments.html.erb │ ├── _new.html.erb │ └── create.js.erb │ ├── examples │ └── index.html.erb │ ├── layouts │ └── application.html.erb │ ├── messages │ ├── index.html.erb │ └── show.html.erb │ └── sessions │ └── new.html.erb ├── bin ├── bundle ├── cable ├── rails ├── rake ├── setup └── spring ├── cable └── config.ru ├── config.ru ├── config ├── application.rb ├── boot.rb ├── cable.yml ├── database.yml ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ └── test.rb ├── initializers │ ├── active_record_belongs_to_required_by_default.rb │ ├── application_controller_renderer.rb │ ├── assets.rb │ ├── backtrace_silencers.rb │ ├── callback_terminator.rb │ ├── cookies_serializer.rb │ ├── cors.rb │ ├── filter_parameter_logging.rb │ ├── session_store.rb │ └── wrap_parameters.rb ├── locales │ └── en.yml ├── routes.rb └── secrets.yml ├── db ├── migrate │ ├── 20150711093646_create_users.rb │ ├── 20150711101414_create_messages.rb │ └── 20150711103112_create_comments.rb ├── schema.rb └── seeds.rb ├── lib ├── assets │ └── .keep └── tasks │ └── .keep ├── log └── .keep ├── public ├── 404.html ├── 422.html ├── 500.html ├── favicon.ico └── robots.txt ├── test ├── controllers │ └── .keep ├── fixtures │ ├── .keep │ └── files │ │ └── .keep ├── helpers │ └── .keep ├── integration │ └── .keep ├── mailers │ └── .keep ├── models │ └── .keep └── test_helper.rb ├── tmp └── .keep └── vendor └── assets ├── javascripts └── .keep └── stylesheets └── .keep /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files. 2 | # 3 | # If you find yourself ignoring temporary files generated by your text editor 4 | # or operating system, you probably want to add a global ignore instead: 5 | # git config --global core.excludesfile '~/.gitignore_global' 6 | 7 | # Ignore bundler config. 8 | /.bundle 9 | 10 | # Ignore the default SQLite database. 11 | /db/*.sqlite3 12 | /db/*.sqlite3-journal 13 | 14 | # Ignore all logfiles and tempfiles. 15 | /log/* 16 | /tmp/* 17 | !/log/.keep 18 | !/tmp/.keep 19 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | 2.2.2 2 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'rails', '5.0.0.beta3' 4 | gem 'sprockets-rails', github: "rails/sprockets-rails" 5 | 6 | gem 'sqlite3' 7 | gem 'redis' 8 | gem 'puma' 9 | 10 | gem 'sass-rails', '~> 5.0' 11 | gem 'uglifier', '>= 1.3.0' 12 | gem 'coffee-rails', github: "rails/coffee-rails" 13 | gem 'jquery-rails' 14 | gem 'turbolinks', github: "rails/turbolinks" 15 | 16 | gem 'jbuilder', '~> 2.0' 17 | 18 | group :development, :test do 19 | gem 'byebug' 20 | end 21 | 22 | group :development do 23 | gem 'web-console', github: 'rails/web-console' 24 | gem 'spring' 25 | end 26 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GIT 2 | remote: git://github.com/rails/coffee-rails.git 3 | revision: 29604a59a5d7ea314f54bb52302d68ef134806bf 4 | specs: 5 | coffee-rails (4.1.1) 6 | coffee-script (>= 2.2.0) 7 | railties (>= 4.0.0, < 5.1.x) 8 | 9 | GIT 10 | remote: git://github.com/rails/sprockets-rails.git 11 | revision: 193e80cd1d682ab9f5b9e9c37de69910c7bdd5dd 12 | specs: 13 | sprockets-rails (3.0.3) 14 | actionpack (>= 4.0) 15 | activesupport (>= 4.0) 16 | sprockets (>= 3.0.0) 17 | 18 | GIT 19 | remote: git://github.com/rails/turbolinks.git 20 | revision: dd31f4b2996f2300631f89339ada82c65b95f4c2 21 | specs: 22 | turbolinks (3.0.0) 23 | coffee-rails 24 | 25 | GIT 26 | remote: git://github.com/rails/web-console.git 27 | revision: 6aa9dd67b8f8dc1111ba6b34bb575b0355ee259b 28 | specs: 29 | web-console (3.0.0) 30 | activemodel (>= 4.2) 31 | debug_inspector 32 | railties (>= 4.2) 33 | 34 | GEM 35 | remote: https://rubygems.org/ 36 | specs: 37 | actioncable (5.0.0.beta3) 38 | actionpack (= 5.0.0.beta3) 39 | nio4r (~> 1.2) 40 | websocket-driver (~> 0.6.1) 41 | actionmailer (5.0.0.beta3) 42 | actionpack (= 5.0.0.beta3) 43 | actionview (= 5.0.0.beta3) 44 | activejob (= 5.0.0.beta3) 45 | mail (~> 2.5, >= 2.5.4) 46 | rails-dom-testing (~> 1.0, >= 1.0.5) 47 | actionpack (5.0.0.beta3) 48 | actionview (= 5.0.0.beta3) 49 | activesupport (= 5.0.0.beta3) 50 | rack (~> 2.x) 51 | rack-test (~> 0.6.3) 52 | rails-dom-testing (~> 1.0, >= 1.0.5) 53 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 54 | actionview (5.0.0.beta3) 55 | activesupport (= 5.0.0.beta3) 56 | builder (~> 3.1) 57 | erubis (~> 2.7.0) 58 | rails-dom-testing (~> 1.0, >= 1.0.5) 59 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 60 | activejob (5.0.0.beta3) 61 | activesupport (= 5.0.0.beta3) 62 | globalid (>= 0.3.6) 63 | activemodel (5.0.0.beta3) 64 | activesupport (= 5.0.0.beta3) 65 | activerecord (5.0.0.beta3) 66 | activemodel (= 5.0.0.beta3) 67 | activesupport (= 5.0.0.beta3) 68 | arel (~> 7.0) 69 | activesupport (5.0.0.beta3) 70 | concurrent-ruby (~> 1.0) 71 | i18n (~> 0.7) 72 | minitest (~> 5.1) 73 | tzinfo (~> 1.1) 74 | arel (7.0.0) 75 | builder (3.2.2) 76 | byebug (8.2.1) 77 | coffee-script (2.4.1) 78 | coffee-script-source 79 | execjs 80 | coffee-script-source (1.10.0) 81 | concurrent-ruby (1.0.1) 82 | debug_inspector (0.0.2) 83 | erubis (2.7.0) 84 | execjs (2.6.0) 85 | globalid (0.3.6) 86 | activesupport (>= 4.1.0) 87 | i18n (0.7.0) 88 | jbuilder (2.4.0) 89 | activesupport (>= 3.0.0, < 5.1) 90 | multi_json (~> 1.2) 91 | jquery-rails (4.1.0) 92 | rails-dom-testing (~> 1.0) 93 | railties (>= 4.2.0) 94 | thor (>= 0.14, < 2.0) 95 | json (1.8.3) 96 | loofah (2.0.3) 97 | nokogiri (>= 1.5.9) 98 | mail (2.6.3) 99 | mime-types (>= 1.16, < 3) 100 | method_source (0.8.2) 101 | mime-types (2.99.1) 102 | mini_portile2 (2.0.0) 103 | minitest (5.8.4) 104 | multi_json (1.11.2) 105 | nio4r (1.2.1) 106 | nokogiri (1.6.7.2) 107 | mini_portile2 (~> 2.0.0.rc2) 108 | puma (2.15.3) 109 | rack (2.0.0.alpha) 110 | json 111 | rack-test (0.6.3) 112 | rack (>= 1.0) 113 | rails (5.0.0.beta3) 114 | actioncable (= 5.0.0.beta3) 115 | actionmailer (= 5.0.0.beta3) 116 | actionpack (= 5.0.0.beta3) 117 | actionview (= 5.0.0.beta3) 118 | activejob (= 5.0.0.beta3) 119 | activemodel (= 5.0.0.beta3) 120 | activerecord (= 5.0.0.beta3) 121 | activesupport (= 5.0.0.beta3) 122 | bundler (>= 1.3.0, < 2.0) 123 | railties (= 5.0.0.beta3) 124 | sprockets-rails (>= 2.0.0) 125 | rails-deprecated_sanitizer (1.0.3) 126 | activesupport (>= 4.2.0.alpha) 127 | rails-dom-testing (1.0.7) 128 | activesupport (>= 4.2.0.beta, < 5.0) 129 | nokogiri (~> 1.6.0) 130 | rails-deprecated_sanitizer (>= 1.0.1) 131 | rails-html-sanitizer (1.0.3) 132 | loofah (~> 2.0) 133 | railties (5.0.0.beta3) 134 | actionpack (= 5.0.0.beta3) 135 | activesupport (= 5.0.0.beta3) 136 | method_source 137 | rake (>= 0.8.7) 138 | thor (>= 0.18.1, < 2.0) 139 | rake (10.5.0) 140 | redis (3.2.2) 141 | sass (3.4.21) 142 | sass-rails (5.0.4) 143 | railties (>= 4.0.0, < 5.0) 144 | sass (~> 3.1) 145 | sprockets (>= 2.8, < 4.0) 146 | sprockets-rails (>= 2.0, < 4.0) 147 | tilt (>= 1.1, < 3) 148 | spring (1.6.2) 149 | sprockets (3.5.2) 150 | concurrent-ruby (~> 1.0) 151 | rack (> 1, < 3) 152 | sqlite3 (1.3.11) 153 | thor (0.19.1) 154 | thread_safe (0.3.5) 155 | tilt (2.0.2) 156 | tzinfo (1.2.2) 157 | thread_safe (~> 0.1) 158 | uglifier (2.7.2) 159 | execjs (>= 0.3.0) 160 | json (>= 1.8.0) 161 | websocket-driver (0.6.3) 162 | websocket-extensions (>= 0.1.0) 163 | websocket-extensions (0.1.2) 164 | 165 | PLATFORMS 166 | ruby 167 | 168 | DEPENDENCIES 169 | byebug 170 | coffee-rails! 171 | jbuilder (~> 2.0) 172 | jquery-rails 173 | puma 174 | rails (= 5.0.0.beta3) 175 | redis 176 | sass-rails (~> 5.0) 177 | spring 178 | sprockets-rails! 179 | sqlite3 180 | turbolinks! 181 | uglifier (>= 1.3.0) 182 | web-console! 183 | 184 | BUNDLED WITH 185 | 1.11.2 186 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Action Cable Examples 2 | 3 | A collection of examples showcasing the capabilities of Action Cable. 4 | 5 | ## Dependencies 6 | 7 | You must have redis installed and running on the default port:6379 (or configure it in config/redis/cable.yml). 8 | 9 | ### Installing Redis 10 | ##### On Linux 11 | * `wget http://download.redis.io/redis-stable.tar.gz` 12 | * `tar xvzf redis-stable.tar.gz` 13 | * `cd redis-stable` 14 | * `make` 15 | * `make install` 16 | 17 | ##### On Mac 18 | * `brew install redis` 19 | 20 | ###### Note: You must have Ruby 2.2.2 installed in order to use redis 21 | 22 | ## Starting the servers 23 | 24 | 1. Run `./bin/setup` 25 | 2. Run `./bin/cable` 26 | 3. Open up a separate terminal and run: `./bin/rails server` 27 | 4. One more terminal to run redis server: `redis-server` 28 | 4. Visit `http://localhost:3000` 29 | 30 | ## Live comments example 31 | 32 | 1. Open two browsers with separate cookie spaces (like a regular session and an incognito session). 33 | 2. Login as different people in each browser. 34 | 3. Go to the same message. 35 | 4. Add comments in either browser and see them appear real-time on the counterpart screen. 36 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require File.expand_path('../config/application', __FILE__) 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /app/assets/images/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vipulnsward/actioncable-examples/a2be8046207cdcc34f28fd33c101cd32d433d5b4/app/assets/images/.keep -------------------------------------------------------------------------------- /app/assets/javascripts/application.js: -------------------------------------------------------------------------------- 1 | // This is a manifest file that'll be compiled into application.js, which will include all the files 2 | // listed below. 3 | // 4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, 5 | // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. 6 | // 7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 8 | // compiled file. 9 | // 10 | // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details 11 | // about supported directives. 12 | // 13 | //= require jquery 14 | //= require jquery_ujs 15 | //= require turbolinks 16 | //= require channels 17 | //= require_tree . 18 | -------------------------------------------------------------------------------- /app/assets/javascripts/channels/comments.coffee: -------------------------------------------------------------------------------- 1 | App.comments = App.cable.subscriptions.create "CommentsChannel", 2 | collection: -> $("[data-channel='comments']") 3 | 4 | connected: -> 5 | # FIXME: While we wait for cable subscriptions to always be finalized before sending messages 6 | setTimeout => 7 | @followCurrentMessage() 8 | @installPageChangeCallback() 9 | , 1000 10 | 11 | received: (data) -> 12 | @collection().append(data.comment) unless @userIsCurrentUser(data.comment) 13 | 14 | userIsCurrentUser: (comment) -> 15 | $(comment).attr('data-user-id') is $('meta[name=current-user]').attr('id') 16 | 17 | followCurrentMessage: -> 18 | if messageId = @collection().data('message-id') 19 | @perform 'follow', message_id: messageId 20 | else 21 | @perform 'unfollow' 22 | 23 | installPageChangeCallback: -> 24 | unless @installedPageChangeCallback 25 | @installedPageChangeCallback = true 26 | $(document).on 'page:change', -> App.comments.followCurrentMessage() 27 | -------------------------------------------------------------------------------- /app/assets/javascripts/channels/index.coffee: -------------------------------------------------------------------------------- 1 | #= require action_cable 2 | #= require_self 3 | #= require_tree . 4 | 5 | @App = {} 6 | App.cable = ActionCable.createConsumer() 7 | -------------------------------------------------------------------------------- /app/assets/stylesheets/application.css: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 6 | * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the 9 | * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS 10 | * files in this directory. It is generally better to create a new file per style scope. 11 | * 12 | *= require_tree . 13 | *= require_self 14 | */ 15 | -------------------------------------------------------------------------------- /app/assets/stylesheets/examples.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the Examples controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/channels/application_cable/channel.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Channel < ActionCable::Channel::Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /app/channels/application_cable/connection.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Connection < ActionCable::Connection::Base 3 | identified_by :current_user 4 | 5 | def connect 6 | self.current_user = find_verified_user 7 | logger.add_tags 'ActionCable', current_user.name 8 | end 9 | 10 | protected 11 | def find_verified_user 12 | if verified_user = User.find_by(id: cookies.signed[:user_id]) 13 | verified_user 14 | else 15 | reject_unauthorized_connection 16 | end 17 | end 18 | end 19 | end -------------------------------------------------------------------------------- /app/channels/comments_channel.rb: -------------------------------------------------------------------------------- 1 | class CommentsChannel < ApplicationCable::Channel 2 | def follow(data) 3 | stop_all_streams 4 | stream_from "messages:#{data['message_id'].to_i}:comments" 5 | end 6 | 7 | def unfollow 8 | stop_all_streams 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | include Authentication 3 | 4 | protect_from_forgery with: :exception 5 | end 6 | -------------------------------------------------------------------------------- /app/controllers/comments_controller.rb: -------------------------------------------------------------------------------- 1 | class CommentsController < ApplicationController 2 | before_action :set_message 3 | 4 | def create 5 | @comment = Comment.create! content: params[:comment][:content], message: @message, user: @current_user 6 | end 7 | 8 | private 9 | def set_message 10 | @message = Message.find(params[:message_id]) 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vipulnsward/actioncable-examples/a2be8046207cdcc34f28fd33c101cd32d433d5b4/app/controllers/concerns/.keep -------------------------------------------------------------------------------- /app/controllers/concerns/authentication.rb: -------------------------------------------------------------------------------- 1 | module Authentication 2 | extend ActiveSupport::Concern 3 | 4 | included do 5 | before_action :ensure_authenticated_user 6 | end 7 | 8 | private 9 | def ensure_authenticated_user 10 | authenticate_user(cookies.signed[:user_id]) || redirect_to(new_session_url) 11 | end 12 | 13 | def authenticate_user(user_id) 14 | if authenticated_user = User.find_by(id: user_id) 15 | cookies.signed[:user_id] ||= user_id 16 | @current_user = authenticated_user 17 | end 18 | end 19 | 20 | def unauthenticate_user 21 | ActionCable.server.disconnect(current_user: @current_user) 22 | @current_user = nil 23 | cookies.delete(:user_id) 24 | end 25 | end -------------------------------------------------------------------------------- /app/controllers/examples_controller.rb: -------------------------------------------------------------------------------- 1 | class ExamplesController < ApplicationController 2 | def index 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /app/controllers/messages_controller.rb: -------------------------------------------------------------------------------- 1 | class MessagesController < ApplicationController 2 | def index 3 | @messages = Message.all 4 | end 5 | 6 | def show 7 | @message = Message.find(params[:id]) 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/controllers/sessions_controller.rb: -------------------------------------------------------------------------------- 1 | class SessionsController < ApplicationController 2 | skip_before_action :ensure_authenticated_user, only: %i( new create ) 3 | 4 | def new 5 | @users = User.all 6 | end 7 | 8 | def create 9 | authenticate_user(params[:user_id]) 10 | redirect_to examples_url 11 | end 12 | 13 | def destroy 14 | unauthenticate_user 15 | redirect_to new_session_url 16 | end 17 | end -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/jobs/application_job.rb: -------------------------------------------------------------------------------- 1 | class ApplicationJob < ActiveJob::Base 2 | end 3 | -------------------------------------------------------------------------------- /app/jobs/comment_relay_job.rb: -------------------------------------------------------------------------------- 1 | class CommentRelayJob < ApplicationJob 2 | def perform(comment) 3 | ActionCable.server.broadcast "messages:#{comment.message_id}:comments", 4 | comment: CommentsController.render(partial: 'comments/comment', locals: { comment: comment }) 5 | end 6 | end -------------------------------------------------------------------------------- /app/mailers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vipulnsward/actioncable-examples/a2be8046207cdcc34f28fd33c101cd32d433d5b4/app/mailers/.keep -------------------------------------------------------------------------------- /app/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vipulnsward/actioncable-examples/a2be8046207cdcc34f28fd33c101cd32d433d5b4/app/models/.keep -------------------------------------------------------------------------------- /app/models/comment.rb: -------------------------------------------------------------------------------- 1 | class Comment < ActiveRecord::Base 2 | belongs_to :message 3 | belongs_to :user 4 | 5 | after_commit { CommentRelayJob.perform_later(self) } 6 | end 7 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vipulnsward/actioncable-examples/a2be8046207cdcc34f28fd33c101cd32d433d5b4/app/models/concerns/.keep -------------------------------------------------------------------------------- /app/models/message.rb: -------------------------------------------------------------------------------- 1 | class Message < ActiveRecord::Base 2 | belongs_to :user 3 | has_many :comments 4 | end 5 | -------------------------------------------------------------------------------- /app/models/user.rb: -------------------------------------------------------------------------------- 1 | class User < ActiveRecord::Base 2 | has_many :messages 3 | has_many :comments 4 | end 5 | -------------------------------------------------------------------------------- /app/views/comments/_comment.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

Comment by <%= comment.user.name %>

3 |

<%= comment.content %>

4 |
-------------------------------------------------------------------------------- /app/views/comments/_comments.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <%= render message.comments %> 3 |
4 | 5 | <%= render 'comments/new', message: message %> 6 | -------------------------------------------------------------------------------- /app/views/comments/_new.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_for [ message, Comment.new ], remote: true do |form| %> 2 | <%= form.text_area :content, size: '100x20' %>
3 | <%= form.submit 'Post comment' %> 4 | <% end %> -------------------------------------------------------------------------------- /app/views/comments/create.js.erb: -------------------------------------------------------------------------------- 1 | $('#comments').append('<%=j render @comment %>'); 2 | $('#new_comment').replaceWith('<%=j render 'comments/new', message: @message %>'); 3 | -------------------------------------------------------------------------------- /app/views/examples/index.html.erb: -------------------------------------------------------------------------------- 1 |

Action Cable Examples

2 | 3 |

4 | Hello <%= @current_user.name %> 5 | (<%= link_to 'Logout', session_path, method: :delete %>)! 6 |

7 | 8 | 11 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Action Cable Examples 5 | <%= action_cable_meta_tag %> 6 | <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': true %> 7 | <%= javascript_include_tag 'application', 'data-turbolinks-track': true %> 8 | <%= csrf_meta_tags %> 9 | 10 | 11 | 12 | 13 | <%= yield %> 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /app/views/messages/index.html.erb: -------------------------------------------------------------------------------- 1 |

Messages

2 | 3 | 8 | -------------------------------------------------------------------------------- /app/views/messages/show.html.erb: -------------------------------------------------------------------------------- 1 |

<%= @message.title %>

2 | 3 |

<%= @message.content %>

4 | 5 | <%= render 'comments/comments', message: @message %> -------------------------------------------------------------------------------- /app/views/sessions/new.html.erb: -------------------------------------------------------------------------------- 1 |

Authenticate as one of the following users

2 | 3 | 8 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /bin/cable: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | bundle exec puma -p 28080 cable/config.ru 3 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path("../spring", __FILE__) 4 | rescue LoadError 5 | end 6 | APP_PATH = File.expand_path('../../config/application', __FILE__) 7 | require_relative '../config/boot' 8 | require 'rails/commands' 9 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path("../spring", __FILE__) 4 | rescue LoadError 5 | end 6 | require_relative '../config/boot' 7 | require 'rake' 8 | Rake.application.run 9 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'pathname' 3 | require 'fileutils' 4 | include FileUtils 5 | 6 | # path to your application root. 7 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) 8 | 9 | chdir APP_ROOT do 10 | # This script is a starting point to setup your application. 11 | # Add necessary setup steps to this file. 12 | 13 | puts '== Installing dependencies ==' 14 | system 'gem install bundler --conservative' 15 | system('bundle check') or system('bundle install') 16 | 17 | # puts "\n== Copying sample files ==" 18 | # unless File.exist?('config/database.yml') 19 | # cp 'config/database.yml.sample', 'config/database.yml' 20 | # end 21 | 22 | puts "\n== Preparing database ==" 23 | system 'ruby bin/rake db:setup' 24 | 25 | puts "\n== Removing old logs and tempfiles ==" 26 | system 'ruby bin/rake log:clear tmp:clear' 27 | 28 | puts "\n== Restarting application server ==" 29 | system 'ruby bin/rake restart' 30 | end 31 | -------------------------------------------------------------------------------- /bin/spring: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | # This file loads spring without using Bundler, in order to be fast. 4 | # It gets overwritten when you run the `spring binstub` command. 5 | 6 | unless defined?(Spring) 7 | require "rubygems" 8 | require "bundler" 9 | 10 | if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m) 11 | Gem.paths = { "GEM_PATH" => [Bundler.bundle_path.to_s, *Gem.path].uniq } 12 | gem "spring", match[1] 13 | require "spring/binstub" 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /cable/config.ru: -------------------------------------------------------------------------------- 1 | require ::File.expand_path('../../config/environment', __FILE__) 2 | Rails.application.eager_load! 3 | 4 | run ActionCable.server 5 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path('../config/environment', __FILE__) 4 | run Rails.application 5 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../boot', __FILE__) 2 | 3 | require 'rails/all' 4 | 5 | # Require the gems listed in Gemfile, including any gems 6 | # you've limited to :test, :development, or :production. 7 | Bundler.require(*Rails.groups) 8 | 9 | module ActioncableExamples 10 | class Application < Rails::Application 11 | # Settings in config/environments/* take precedence over those specified here. 12 | # Application configuration should go into files in config/initializers 13 | # -- all .rb files in that directory are automatically loaded. 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 2 | 3 | require 'bundler/setup' # Set up gems listed in the Gemfile. 4 | -------------------------------------------------------------------------------- /config/cable.yml: -------------------------------------------------------------------------------- 1 | # production: 2 | # url: redis://redis.example.com:6379 3 | 4 | local: &local 5 | url: redis://localhost:6379 6 | 7 | development: *local 8 | test: *local 9 | -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | default: &default 2 | adapter: sqlite3 3 | pool: 105 4 | timeout: 5000 5 | 6 | development: 7 | <<: *default 8 | database: db/development.sqlite3 9 | 10 | # Warning: The database defined as "test" will be erased and 11 | # re-generated from your development database when you run "rake". 12 | # Do not set this db to the same as development or production. 13 | test: 14 | <<: *default 15 | database: db/test.sqlite3 16 | 17 | production: 18 | <<: *default 19 | database: db/production.sqlite3 20 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # In the development environment your application's code is reloaded on 5 | # every request. This slows down response time but is perfect for development 6 | # since you don't have to restart the web server when you make code changes. 7 | config.cache_classes = false 8 | 9 | # Do not eager load code on boot. 10 | config.eager_load = false 11 | 12 | # Show full error reports and disable caching. 13 | config.consider_all_requests_local = true 14 | config.action_controller.perform_caching = false 15 | 16 | # Don't care if the mailer can't send. 17 | config.action_mailer.raise_delivery_errors = false 18 | 19 | # Print deprecation notices to the Rails logger. 20 | config.active_support.deprecation = :log 21 | 22 | # Raise an error on page load if there are pending migrations. 23 | config.active_record.migration_error = :page_load 24 | 25 | # Debug mode disables concatenation and preprocessing of assets. 26 | # This option may cause significant delays in view rendering with a large 27 | # number of complex assets. 28 | config.assets.debug = true 29 | 30 | # Asset digests allow you to set far-future HTTP expiration dates on all assets, 31 | # yet still be able to expire them through the digest params. 32 | config.assets.digest = true 33 | 34 | # Adds additional error checking when serving assets at runtime. 35 | # Checks for improperly declared sprockets dependencies. 36 | # Raises helpful error messages. 37 | config.assets.raise_runtime_errors = true 38 | 39 | # Raises error for missing translations 40 | # config.action_view.raise_on_missing_translations = true 41 | 42 | # Set Action Cable server url for consumer connection 43 | config.action_cable.url = 'ws://localhost:28080' 44 | end 45 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # Code is not reloaded between requests. 5 | config.cache_classes = true 6 | 7 | # Eager load code on boot. This eager loads most of Rails and 8 | # your application in memory, allowing both threaded web servers 9 | # and those relying on copy on write to perform better. 10 | # Rake tasks automatically ignore this option for performance. 11 | config.eager_load = true 12 | 13 | # Full error reports are disabled and caching is turned on. 14 | config.consider_all_requests_local = false 15 | config.action_controller.perform_caching = true 16 | 17 | # Disable serving static files from the `/public` folder by default since 18 | # Apache or NGINX already handles this. 19 | config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? 20 | 21 | # Compress JavaScripts and CSS. 22 | config.assets.js_compressor = :uglifier 23 | # config.assets.css_compressor = :sass 24 | 25 | # Do not fallback to assets pipeline if a precompiled asset is missed. 26 | config.assets.compile = false 27 | 28 | # Asset digests allow you to set far-future HTTP expiration dates on all assets, 29 | # yet still be able to expire them through the digest params. 30 | config.assets.digest = true 31 | 32 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb 33 | 34 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 35 | # config.action_controller.asset_host = 'http://assets.example.com' 36 | 37 | # Specifies the header that your server uses for sending files. 38 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache 39 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX 40 | 41 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 42 | # config.force_ssl = true 43 | 44 | # Use the lowest log level to ensure availability of diagnostic information 45 | # when problems arise. 46 | config.log_level = :debug 47 | 48 | # Prepend all log lines with the following tags. 49 | # config.log_tags = [ :subdomain, :request_id ] 50 | 51 | # Use a different logger for distributed setups. 52 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) 53 | 54 | # Use a different cache store in production. 55 | # config.cache_store = :mem_cache_store 56 | 57 | # Use a real queuing backend for Active Job (and separate queues per environment) 58 | # config.active_job.queue_adapter = :resque 59 | # config.active_job.queue_name_prefix = "actioncable-examples_#{Rails.env}" 60 | 61 | # Ignore bad email addresses and do not raise email delivery errors. 62 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 63 | # config.action_mailer.raise_delivery_errors = false 64 | 65 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 66 | # the I18n.default_locale when a translation cannot be found). 67 | config.i18n.fallbacks = true 68 | 69 | # Send deprecation notices to registered listeners. 70 | config.active_support.deprecation = :notify 71 | 72 | # Use default logging formatter so that PID and timestamp are not suppressed. 73 | config.log_formatter = ::Logger::Formatter.new 74 | 75 | # Do not dump schema after migrations. 76 | config.active_record.dump_schema_after_migration = false 77 | 78 | # Set Action Cable server url for consumer connection 79 | # config.action_cable.url = 'ws://cable.example.com:28080' 80 | end 81 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # The test environment is used exclusively to run your application's 5 | # test suite. You never need to work with it otherwise. Remember that 6 | # your test database is "scratch space" for the test suite and is wiped 7 | # and recreated between test runs. Don't rely on the data there! 8 | config.cache_classes = true 9 | 10 | # Do not eager load code on boot. This avoids loading your whole application 11 | # just for the purpose of running a single test. If you are using a tool that 12 | # preloads Rails for running tests, you may have to set it to true. 13 | config.eager_load = false 14 | 15 | # Configure static file server for tests with Cache-Control for performance. 16 | config.serve_static_files = true 17 | config.static_cache_control = 'public, max-age=3600' 18 | 19 | # Show full error reports and disable caching. 20 | config.consider_all_requests_local = true 21 | config.action_controller.perform_caching = false 22 | 23 | # Raise exceptions instead of rendering exception templates. 24 | config.action_dispatch.show_exceptions = false 25 | 26 | # Disable request forgery protection in test environment. 27 | config.action_controller.allow_forgery_protection = false 28 | 29 | # Tell Action Mailer not to deliver emails to the real world. 30 | # The :test delivery method accumulates sent emails in the 31 | # ActionMailer::Base.deliveries array. 32 | config.action_mailer.delivery_method = :test 33 | 34 | # Randomize the order test cases are executed. 35 | config.active_support.test_order = :random 36 | 37 | # Print deprecation notices to the stderr. 38 | config.active_support.deprecation = :stderr 39 | 40 | # Raises error for missing translations 41 | # config.action_view.raise_on_missing_translations = true 42 | end 43 | -------------------------------------------------------------------------------- /config/initializers/active_record_belongs_to_required_by_default.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Require `belongs_to` associations by default. 4 | Rails.application.config.active_record.belongs_to_required_by_default = true 5 | -------------------------------------------------------------------------------- /config/initializers/application_controller_renderer.rb: -------------------------------------------------------------------------------- 1 | ## Change renderer defaults here. 2 | # 3 | # ApplicationController.renderer.defaults.merge!( 4 | # http_host: 'example.org', 5 | # https: false 6 | # ) 7 | -------------------------------------------------------------------------------- /config/initializers/assets.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Version of your assets, change this if you want to expire all your assets. 4 | Rails.application.config.assets.version = '1.0' 5 | 6 | # Add additional assets to the asset load path 7 | # Rails.application.config.assets.paths << Emoji.images_path 8 | 9 | # Precompile additional assets. 10 | # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. 11 | # Rails.application.config.assets.precompile += %w( search.js ) 12 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /config/initializers/callback_terminator.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Do not halt callback chains when a callback returns false. 4 | ActiveSupport.halt_callback_chains_on_return_false = false 5 | -------------------------------------------------------------------------------- /config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.action_dispatch.cookies_serializer = :json 4 | -------------------------------------------------------------------------------- /config/initializers/cors.rb: -------------------------------------------------------------------------------- 1 | # Avoid CORS issues when API is called from the frontend app 2 | # Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin AJAX requests 3 | 4 | # Read more: https://github.com/cyu/rack-cors 5 | 6 | # Rails.application.config.middleware.insert_before 0, "Rack::Cors" do 7 | # allow do 8 | # origins 'example.com' 9 | # 10 | # resource '*', 11 | # headers: :any, 12 | # methods: [:get, :post, :put, :patch, :delete, :options, :head] 13 | # end 14 | # end 15 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password] 5 | -------------------------------------------------------------------------------- /config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.session_store :cookie_store, key: '_actioncable-examples_session' 4 | -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] 9 | end 10 | 11 | # To enable root element in JSON for ActiveRecord objects. 12 | # ActiveSupport.on_load(:active_record) do 13 | # self.include_root_in_json = true 14 | # end 15 | -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Files in the config/locales directory are used for internationalization 2 | # and are automatically loaded by Rails. If you want to use locales other 3 | # than English, add the necessary files in this directory. 4 | # 5 | # To use the locales, use `I18n.t`: 6 | # 7 | # I18n.t 'hello' 8 | # 9 | # In views, this is aliased to just `t`: 10 | # 11 | # <%= t('hello') %> 12 | # 13 | # To use a different locale, set it with `I18n.locale`: 14 | # 15 | # I18n.locale = :es 16 | # 17 | # This would use the information in config/locales/es.yml. 18 | # 19 | # To learn more, please read the Rails Internationalization guide 20 | # available at http://guides.rubyonrails.org/i18n.html. 21 | 22 | en: 23 | hello: "Hello world" 24 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | resource :session 3 | resources :examples 4 | 5 | resources :messages do 6 | resources :comments 7 | end 8 | 9 | root 'examples#index' 10 | end 11 | -------------------------------------------------------------------------------- /config/secrets.yml: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Your secret key is used for verifying the integrity of signed cookies. 4 | # If you change this key, all old signed cookies will become invalid! 5 | 6 | # Make sure the secret is at least 30 characters and all random, 7 | # no regular words or you'll be exposed to dictionary attacks. 8 | # You can use `rake secret` to generate a secure secret key. 9 | 10 | # Make sure the secrets in this file are kept private 11 | # if you're sharing your code publicly. 12 | 13 | development: 14 | secret_key_base: c4f64de223e7a916ae10188c9db279869e3fe2c9ef5789b3a7271acdc70362a04e0de81bb2f4e691dd9dfa3e69fe1d8b36137613a18046c336fef600f19c5e59 15 | 16 | test: 17 | secret_key_base: 2b89ad83fbf7392e9df143617a3a69bc3ebad040a3c149bd37439471a601fb92a59d9d74bba664c2394929ae11f23b2bd8f8e33a82bd7f4b8d9bfb891bd96a48 18 | 19 | # Do not keep production secrets in the repository, 20 | # instead read values from the environment. 21 | production: 22 | secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> 23 | -------------------------------------------------------------------------------- /db/migrate/20150711093646_create_users.rb: -------------------------------------------------------------------------------- 1 | class CreateUsers < ActiveRecord::Migration 2 | def change 3 | create_table :users do |t| 4 | t.string :name 5 | 6 | t.timestamps 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20150711101414_create_messages.rb: -------------------------------------------------------------------------------- 1 | class CreateMessages < ActiveRecord::Migration 2 | def change 3 | create_table :messages do |t| 4 | t.references :user, index: true, foreign_key: true 5 | 6 | t.string :title 7 | t.text :content 8 | 9 | t.timestamps 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20150711103112_create_comments.rb: -------------------------------------------------------------------------------- 1 | class CreateComments < ActiveRecord::Migration 2 | def change 3 | create_table :comments do |t| 4 | t.references :message, index: true, foreign_key: true 5 | t.references :user, index: true, foreign_key: true 6 | 7 | t.text :content 8 | 9 | t.timestamps 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/schema.rb: -------------------------------------------------------------------------------- 1 | # encoding: UTF-8 2 | # This file is auto-generated from the current state of the database. Instead 3 | # of editing this file, please use the migrations feature of Active Record to 4 | # incrementally modify your database, and then regenerate this schema definition. 5 | # 6 | # Note that this schema.rb definition is the authoritative source for your 7 | # database schema. If you need to create the application database on another 8 | # system, you should be using db:schema:load, not running all the migrations 9 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations 10 | # you'll amass, the slower it'll run and the greater likelihood for issues). 11 | # 12 | # It's strongly recommended that you check this file into your version control system. 13 | 14 | ActiveRecord::Schema.define(version: 20150711103112) do 15 | 16 | create_table "comments", force: :cascade do |t| 17 | t.integer "message_id" 18 | t.integer "user_id" 19 | t.text "content" 20 | t.datetime "created_at", null: false 21 | t.datetime "updated_at", null: false 22 | t.index ["message_id"], name: "index_comments_on_message_id" 23 | t.index ["user_id"], name: "index_comments_on_user_id" 24 | end 25 | 26 | create_table "messages", force: :cascade do |t| 27 | t.integer "user_id" 28 | t.string "title" 29 | t.text "content" 30 | t.datetime "created_at", null: false 31 | t.datetime "updated_at", null: false 32 | t.index ["user_id"], name: "index_messages_on_user_id" 33 | end 34 | 35 | create_table "users", force: :cascade do |t| 36 | t.string "name" 37 | t.datetime "created_at", null: false 38 | t.datetime "updated_at", null: false 39 | end 40 | 41 | end 42 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). 3 | 4 | big = User.create! name: 'The Notorious B.I.G.' 5 | snoop = User.create! name: 'Snoop Dogg' 6 | flex = User.create! name: 'Funkmaster Flex' 7 | ice = User.create! name: 'Ice Cube' 8 | 9 | Message.create! title: 'Tha Shiznit', content: 'Poppin, stoppin, hoppin like a rabbit', user: snoop 10 | Message.create! title: 'Hypnotize ', content: 'Hah, sicker than your average Poppa', user: big 11 | -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vipulnsward/actioncable-examples/a2be8046207cdcc34f28fd33c101cd32d433d5b4/lib/assets/.keep -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vipulnsward/actioncable-examples/a2be8046207cdcc34f28fd33c101cd32d433d5b4/lib/tasks/.keep -------------------------------------------------------------------------------- /log/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vipulnsward/actioncable-examples/a2be8046207cdcc34f28fd33c101cd32d433d5b4/log/.keep -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The page you were looking for doesn't exist.

62 |

You may have mistyped the address or the page may have moved.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The change you wanted was rejected.

62 |

Maybe you tried to change something you didn't have access to.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

We're sorry, but something went wrong.

62 |
63 |

If you are the application owner check the logs for more information.

64 |
65 | 66 | 67 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vipulnsward/actioncable-examples/a2be8046207cdcc34f28fd33c101cd32d433d5b4/public/favicon.ico -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-agent: * 5 | # Disallow: / 6 | -------------------------------------------------------------------------------- /test/controllers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vipulnsward/actioncable-examples/a2be8046207cdcc34f28fd33c101cd32d433d5b4/test/controllers/.keep -------------------------------------------------------------------------------- /test/fixtures/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vipulnsward/actioncable-examples/a2be8046207cdcc34f28fd33c101cd32d433d5b4/test/fixtures/.keep -------------------------------------------------------------------------------- /test/fixtures/files/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vipulnsward/actioncable-examples/a2be8046207cdcc34f28fd33c101cd32d433d5b4/test/fixtures/files/.keep -------------------------------------------------------------------------------- /test/helpers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vipulnsward/actioncable-examples/a2be8046207cdcc34f28fd33c101cd32d433d5b4/test/helpers/.keep -------------------------------------------------------------------------------- /test/integration/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vipulnsward/actioncable-examples/a2be8046207cdcc34f28fd33c101cd32d433d5b4/test/integration/.keep -------------------------------------------------------------------------------- /test/mailers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vipulnsward/actioncable-examples/a2be8046207cdcc34f28fd33c101cd32d433d5b4/test/mailers/.keep -------------------------------------------------------------------------------- /test/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vipulnsward/actioncable-examples/a2be8046207cdcc34f28fd33c101cd32d433d5b4/test/models/.keep -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | ENV['RAILS_ENV'] ||= 'test' 2 | require File.expand_path('../../config/environment', __FILE__) 3 | require 'rails/test_help' 4 | 5 | class ActiveSupport::TestCase 6 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. 7 | fixtures :all 8 | 9 | # Add more helper methods to be used by all tests here... 10 | end 11 | -------------------------------------------------------------------------------- /tmp/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vipulnsward/actioncable-examples/a2be8046207cdcc34f28fd33c101cd32d433d5b4/tmp/.keep -------------------------------------------------------------------------------- /vendor/assets/javascripts/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vipulnsward/actioncable-examples/a2be8046207cdcc34f28fd33c101cd32d433d5b4/vendor/assets/javascripts/.keep -------------------------------------------------------------------------------- /vendor/assets/stylesheets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vipulnsward/actioncable-examples/a2be8046207cdcc34f28fd33c101cd32d433d5b4/vendor/assets/stylesheets/.keep --------------------------------------------------------------------------------