Skip to content
This repository has been archived by the owner on Nov 16, 2018. It is now read-only.

Commit

Permalink
Unify get_schwifty in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
danielwestendorf committed Oct 4, 2017
1 parent 02f7eeb commit 145b5b6
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# GetSchwifty
# get_schwifty
>Oh, yeah!
You gotta get schwifty.
You gotta get schwifty in here.

GetSchwifty is a Rails plugin for rendering slow view partials in a background job and sending them to the client over ActionCable websockets.
get_schwifty is a Rails plugin for rendering slow view partials in a background job and sending them to the client over ActionCable websockets.

[![CI](https://travis-ci.org/danielwestendorf/get_schwifty.svg?branch=master)](https://travis-ci.org/danielwestendorf/get_schwifty) [![Gem Version](https://badge.fury.io/rb/get_schwifty.svg)](https://badge.fury.io/rb/get_schwifty)

## Justification

Slow-to-render HTML elements can be expensive (hosting) and unavoidable (technical debt, slow libs, expensive db queries, etc). Rendering in-line in your web server consumes a connection which could be serving other clients. Sometimes it's better to just return a minimal page quickly, and let the data backfill as it's generated.

GetSchwifty is all about quick responses by utilizing background jobs to do the rendering for your and delivering it to the client with ActionCable.
get_schwifty is all about quick responses by utilizing background jobs to do the rendering for your and delivering it to the client with ActionCable.

## Caveats

Expand All @@ -21,7 +23,6 @@ get_schwifty was extracted from [HireLoop.io](https://www.hireloop.io), a platfo

Make hiring delightful by closing the loop between hiring managers and every applicant. Automate the trival tasks associated with screening job applicants, lowering the barrier for easy and clear communication.

[![CI](https://travis-ci.org/danielwestendorf/get_schwifty.svg?branch=master)](https://travis-ci.org/danielwestendorf/get_schwifty) [![Gem Version](https://badge.fury.io/rb/get_schwifty.svg)](https://badge.fury.io/rb/get_schwifty)

## Installation
Add this line to your application's Gemfile:
Expand Down Expand Up @@ -49,12 +50,12 @@ Follow the instructions printed.

## Usage

Generate your first GetSchwifty Cable
Generate your first get_schwifty Cable
```bash
$ rails generate get_schwifty:cable Calculator fibonacci
```

Cables are a place to put your data access logic. Think Controllers for each GetSchwifty cable.
Cables are a place to put your data access logic. Think Controllers for each get_schwifty cable.
```ruby
# app/cables/calculator_cable.rb

Expand Down Expand Up @@ -84,7 +85,7 @@ When the data has been queried/generated, the partial is rendered. `stream` is a
```

Lastly, we need to tell the app where to render this chunk of HTML. GetSchwifty uses a similar routing syntax to Rails routes of `cablecontrollername#action`.
Lastly, we need to tell the app where to render this chunk of HTML. get_schwifty uses a similar routing syntax to Rails routes of `cablecontrollername#action`.

```erb
# app/views/yourpage.html.erb
Expand All @@ -102,7 +103,7 @@ Load the page, and you should get the whole page back quickly, while the Fibonac

### Identifiers & Params

Random data isn't very useful. Unauthenticated data isn't very cool either. Usually in Rails data scoping belongs starts at a current_user method. GetSchwifty will make any identefiers or params made available in the channel subscription within your cables. Let's take a look at an example.
Random data isn't very useful. Unauthenticated data isn't very cool either. Usually in Rails data scoping belongs starts at a current_user method. get_schwifty will make any identefiers or params made available in the channel subscription within your cables. Let's take a look at an example.

#### Identifiers
Here we'll find the current user. This is copied form the [Rails Guides](http://guides.rubyonrails.org/action_cable_overview.html#connection-setup).
Expand Down

0 comments on commit 145b5b6

Please sign in to comment.