Engage!

Engage! is a Rails gem that adds a user support forum to your Rails application.

Installation

  1. Add Engage! to the application's Gemfile: gem 'engagecsm'.

  2. Install it: bundle install.

  3. Run the generator: rails generate engage User.

  4. Run the migrations: rake db:migrate.

The engage generator takes a model name as its argument, so just substitute User with you model name: rails generate engage YourModel

If the model exists, Engage! hooks into it assuming there's already an authentication mechanism in place. If it doesn't exist, the generator additionally creates a devise based authentication system.

Configuration

The following options can be set up in config/initializers/engage.rb:

Managing users

Any user can be given admin privileges, initially by running something like: user.engage_user_profile.update_attribute(:admin, true). After that, a link "Manage users" is being displayed for the logged in user.

Customization

You can easily customize colors and other styles Engage! uses by editing .scss files that are generated in app/assets/stylesheets/engage.

If you'd like to modify the views Engage! uses for its internal authentication, run rails generate engage:devise_views and take a look at app/views/devise.

More

If you need to modify how the engine works, you can use a supplied test suite to help you ensure that you didn't break anything. Please note that due to the various possible usages of the engine's generator there is a need to separately test a few different setups. The engine's test suite uses customized dummy apps to achieve this and runs only relevant RSpec examples. To create a new test app variant, take a look at the dummy app template (spec/dummyapptemplate), think about what you would like to do with it (including running the Engage! generator), and describe it in a new file in the spec/appvariants directory. deviseuser.rb file is a good example of such a file - it prepares a standard devise user authentication setup and plugs the engine right into it.

To mark a RSpec block as relevant to the devise_user app variant, tag it like this:

describe Engage::Comment, :devise_user do
  ...
end

You can tag it and context blocks as well. There is also one special tag, :universal, to make an example or group of them run every time, regardless of current app variant.

Finally, to run the specs, use one of the following:

APP_VARIANT=devise_user guard # will run Guard with devise_user app variant active
APP_VARIANT=devise_user rspec spec # will run all relevant examples once  
rake spec # will run all examples for all app variants

By default, the dummy app isn't regenerated with each test run. To force such behaviour, pass REGENERATE_DUMMY_APP environment variable like this:

REGENERATE_DUMMY_APP=true APP_VARIANT=devise_user guard