Denshobato is a Rails gem that helps models communicate with each other. It gives simple api for creating a complete conversation system. You can create conversation with any model. Denshobato provides api methods for making conversation, messages, blacklists and trash. It also provides Helper methods for controller and view.
In this tutorial, we’ll create messaging system from scratch. A most part of work Denshobato gem will take over.
Add bootstrap-sass gem for styles, Devise for quick users authentication, slim-rails for templates, and Denshobato for messaging.
run bundle install
And install Denshobato
Now run rake db:migrate
Next, we need to set up a basic authentication for reseller and customer model.
Add this helpful method to ApplicationController
And to ApplicationHelper
Generate WelcomeController, with home action for root path.
Add route to root path.
Add this to welcome/home.html.slim
Next, add header to our application layout and import bootstrap styles, if you haven`t done it yet.
As long as we have two different models, for sake of brevity, we’ll use devise_url_helper, which generates correct route, obviously based on your model. name.
In Links partial
It should look like this
Next, we create the reseller’s controller and customer’s controller.
Don`t forget about routes
Make the same with Customer (controller and index view)
Let’s create a few resellers and customers
go to rails c
Okay, looks like we bootstraped everything we need at this point.
We ready to set up messaging system for our Reseller and Customer.