Skip to content

Pasta/badgr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Badgr

Adds badge and achievement system to you app.

Inspired by : stackoverflow.com/questions/885277/how-to-implement-an-achievement-system-in-ror

Installation into your rails app

Dead simple, add this to your gemfile:

gem ‘badgr’, :git => “git:https://github.com/Pasta/badgr.git” And then:

rails g badgr

It will add some methods to your User model (for now, the model name you can add badges onto is restricted to User) through a line you have to add into your User model: class User < ActiveRecord::Base include Achievements

It also create a migration file that you have to run through

rake db:migrate

How to create an achievement?

Simply run

rails g achievement YouAchievementFantasticName

It should create you 3 files:

  1. A model (YouAchievementFantasticNameAchievement), in which you have to set the condition for the badge to be earn

  2. An observer (YouAchievementFantasticNameAchievementObserver), which you can destroy or modify to observe a model to award a badge

  3. A test file (YouAchievementFantasticNameAchievementTest) to test the model.

About

Adds badge and achievement system to you app.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages