Install the Rails gem if you haven't done so before
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a skeleton for testing models including examples of validations, callbacks, | |
# scopes, instance & class methods, associations, and more. | |
# Pick and choose what you want, as all models don't NEED to be tested at this depth. | |
# | |
# I'm always eager to hear new tips & suggestions as I'm still new to testing, | |
# so if you have any, please share! | |
# | |
# @kyletcarlson | |
# | |
# This skeleton also assumes you're using the following gems: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rails_helper' | |
RSpec.describe TodosController, :type => :controller do | |
describe "GET #index" do | |
#describe "POST #create" do | |
#describe "GET #show" do | |
#describe "PATCH #update" do (or PUT #update) | |
#describe "DELETE #destroy" do | |
#describe "GET #new" do |
In this episode we're going to be adding realtime notifications into your app using ActionCable. We've talked about notifications a few times in the past and we used AJAX polling for that. 95% of the time, polling is the solution that would be recommended for it.
But if you're looking for a good introduction into ActionCable then this is a decent one because we're only really using it for one way from the server side to the client side.
So to get started we're starting with an app that has Bootstrap installed and then we created a Main controller with an index view which is where we will list our Notifications as for this example.
Before we generate our channels let's install a few things
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## API | |
* http://apionrails.icalialabs.com/book/chapter_one | |
* https://medium.com/statuscode/introducing-webpacker-7136d66cddfb#.9aou0hodw | |
* https://blog.codeship.com/building-a-json-api-with-rails-5/ | |
* http://blog.arkency.com/2016/02/how-and-why-should-you-use-json-api-in-your-rails-api/ | |
* https://github.com/tiagopog/jsonapi-utils | |
* https://robots.thoughtbot.com/validating-json-schemas-with-an-rspec-matcher | |
* https://github.com/interagent/heroics | |
* http://weblog.rubyonrails.org/2017/2/23/Rails-5-1-beta1/ | |
* http://blog.michelada.io/whats-new-in-rails-51 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding | |
class ModelName < ApplicationRecord | |
# require statements | |
# extend Modules | |
# include Modules | |
# Gem/Plugins options | |
# CONSTANTS | |
# Attribute accessors | |
# serialize attributes |