Skip to content

Instantly share code, notes, and snippets.

View AquisTech's full-sized avatar
💻
Speaking via <code/>

AquisTech AquisTech

💻
Speaking via <code/>
View GitHub Profile
@AquisTech
AquisTech / model_sequence.rb
Last active November 15, 2020 03:48
Order of elements arrangement in Model
# encoding
class ModelName < ApplicationRecord
# require statements
# extend Modules
# include Modules
# Gem/Plugins options
# CONSTANTS
# Attribute accessors
# serialize attributes
## 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

Realtime Notifications with ActionCable

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.

Getting started

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

@mdang
mdang / RAILS_CHEATSHEET.md
Last active April 13, 2024 15:36
Ruby on Rails Cheatsheet

Ruby on Rails Cheatsheet

Architecture

Create a new application

Install the Rails gem if you haven't done so before

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
@SabretWoW
SabretWoW / rspec_model_testing_template.rb
Last active March 7, 2024 03:56
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
# 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: