Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Add the possibility to rate any DataMapper::Resource by remixing a Rating module
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
tasks
.gitignore
Gemfile
History.txt
LICENSE
Manifest.txt
README.textile
Rakefile
TODO
VERSION
dm-is-rateable.gemspec

README.textile

dm-is-rateable

A DataMapper plugin that adds the ability to rate any model (the 5 clickable stars I see everywhere).


# GEM_DEPENDENCIES = [
#  ["dm-core",         ">=0.9.4"], 
#  ["dm-is-remixable", ">=0.9.4"], 
#  ["dm-validations",  ">=0.9.4"],
#  ["dm-aggregates",   ">=0.9.4"],
#  ["dm-timestamps",   ">=0.9.4"],
#  ["dm-types",        ">=0.9.4"],
# ]
  
class User
  include DataMapper::Resource
  property :id, Serial
end

class Trip

  include DataMapper::Resource
  property :id, Serial

  # will define and thus auto_migrate! by using dm-is-remixable:
  #
  # class TripRating
  #   include DataMapper::Resource
  #   property :id, Serial
  #   property :trip_id, Integer, :nullable => false
  #   property :user_id, Integer, :nullable => false
  #   property :rating,  Integer, :nullable => false
  #
  #   belongs_to :user
  # end
  #
  # allowing the following options:
  #
  # options = {
  #  :rater => { :name => :user_id, :type => Integer },
  #  :allowed_ratings => (0..5),
  #  :timestamps => true,
  #  :as => nil,                     # if symbol/string then add an alias by that name on has n, :ratings
  #  :class_name => "#{self}Rating"  # class_name to use for generated remixed model
  # }
  
  is :rateable #, options
  
end

Something went wrong with that request. Please try again.