Manage the Rails object succession easily.
If you want to provide a user manage succession for a Rails object, you can simply add this gem.
Add to your Gemfile:
gem succession
and run the bundle install command. After the installation type into your terminal:
rake succession:install:migrations
to move the gem's migrations into your application.
To add the succession behavior, put this code into your model.
class Post < ActiveRecord::Base
include Succession
# Your code.
end
There are two ways to implement the up and down rating into your view.
If you want to use links add this into your view files:
For up rating:
<%= up_link_to "rate up", @post%>
For down rating:
<%= down_link_to "rate up", @post%>
If you are more the button type, use this:
For up rating:
<%= up_button_to "rate up", @post%>
For down rating:
<%= down_button_to "rate up", @post%>
Copyright (c) 2013 Fadendaten GmbH. See MIT-LICENSE for details.