Sha256: ecda2c2e808cd874f13f948cd3f20056c720a92b2f1fdd02f67bff9ac3af12ce

Contents?: true

Size: 784 Bytes

Versions: 1

Compression:

Stored size: 784 Bytes

Contents

# SelfRenderer

Rails model & object rendering outside the context of web requests.

## Use Cases

* Serialize model in background job to send over ActionCable
* etc....

## Quick Start

```sh
gem install self_renderer
```

```ruby
require "self_renderer"

class User < ApplicationRecord
  include SelfRenderer
end
```

```ruby
# render html strings
User.find(1).render_to_html(template: "users/show.html.erb")
User.find(2).render_to_html(partial: "users/_item.html.erb")

# render json strings
User.find(3).render_to_json(template: "users/show.json.jbuilder")
User.find(4).render_to_json(partial: "users/_item.json.jbuilder")

# render ruby hashes
User.find(5).render_to_hash(template: "users/show.json.jbuilder")
User.find(6).render_to_hash(partial: "users/show.json.jbuilder")
```

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
self_renderer-0.1.0 README.md