Project

commentui

0.0
No commit activity in last 3 years
No release in over 3 years
Allow user to post comment to your models by APIs
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.7.5
~> 2.6
~> 0.18.4
~> 0.3.9
~> 4.2.1
~> 0.17.1

Runtime

~> 3.6.0
~> 5.1.6
 Project Readme

Commentui

A simple comment API gem

Installation

1. Gem install

Add this line to your application's Gemfile:

gem 'commentui', "~> 0.2.0"

And then execute:

$ bundle install

Or install it yourself as:

$ gem install commentui

2. Migrations

Run the following command to copy Commentui's migrations to your application (run when update gem also):

$ bundle exec rake commentui:install:migrations

Then run migrate database command:

$ rake db:migrate

To remove engine migration, run:

$ rake db:migrate SCOPE=commentui VERSION=0

3. Initializers

Run the following command to copy Commentui's initializers to your application:

$ bundle exec rake commentui:install:initializers

4. Route config

Add this line to your Rails application's routes.rb file:

  mount Commentui::Engine => '/commentui'

Usage

1. Models

Add this line to your model(s) should be able to post comments (usually user model):

  acts_as_commentuier

The model'll look like:

  class User < ApplicationRecord
    acts_as_commentuier
  end

Add this line to any models you want to be able to comment on (post,...)

  acts_as_commentuiable

The model'll look like:

  class Post < ApplicationRecord
    acts_as_commentuiable
  end

2. Controllers

Supported actions

Helper HTTP Verb Path Controller#Action
topic_comments_path GET /topics/:topic_id/comments(.:format) commentui/comments#index
POST /topics/:topic_id/comments(.:format) commentui/comments#create
topic_comment_path GET /topics/:topic_id/comments/:id(.:format) commentui/comments#show
PATCH /topics/:topic_id/comments/:id(.:format) commentui/comments#update
PUT /topics/:topic_id/comments/:id(.:format) commentui/comments#update
DELETE /topics/:topic_id/comments/:id(.:format) commentui/comments#destroy
topic_path GET /topics/:id(.:format) commentui/topics#show

Contributing

Contribution directions go here.

License

The gem is available as open source under the terms of the MIT License.