Permalink
Browse files

mend

gem name is changed from rateit to letsrate
  • Loading branch information...
2 parents 2d9da23 + 1e5ee16 commit 5f76981849cb60635bc8071ae93f86e1d499488b @muratguzel committed Sep 7, 2012
View
@@ -1,22 +1,22 @@
-# Rateit Rating Gem
+# Letsrate Rating Gem
Provides the best way to add rating capabilites to your Rails application with jQuery Raty plugin.
## Repository
-Find it at [github.com/muratguzel/rateit](github.com/muratguzel/rateit)
+Find it at [github.com/muratguzel/letsrate](github.com/muratguzel/letsrate)
## Instructions
### Install
-You can add the rateit gem into your Gemfile
+You can add the letsrate gem into your Gemfile
- gem 'rateit'
+ gem 'letsrate'
### Generate
- rails g rateit User
+ rails g letsrate User
The generator takes one argument which is the name of your existing devise user model UserModelName. This is necessary to bind the user and rating datas.
Also the generator copies necessary files (jquery raty plugin files, star icons and javascripts)
@@ -27,7 +27,7 @@ Suppose you will have a devise user model which name is User. The generator shou
rails g devise:install
rails g devise user
- rails g rateit user # => This is rateit generator.
+ rails g letsrate user # => This is letsrate generator.
This generator will create Rate and RatingCache models and link to your user model.
@@ -37,16 +37,16 @@ I suppose you have a car model
rails g model car name:string
-You should add the rateit_rateable function with its dimensions option.
+You should add the letsrate_rateable function with its dimensions option.
class Car < ActiveRecord::Base
- rateit_rateable :dimensions => [:speed, :engine, :price]
+ letsrate_rateable :dimensions => [:speed, :engine, :price]
end
-Then you need to add a call rateit_rater in the user model.
+Then you need to add a call letsrate_rater in the user model.
class User < ActiveRecord::Base
- rateit_rater
+ letsrate_rater
end
@@ -84,6 +84,6 @@ as you will.
end
## Feedback
-If you find bugs please open a ticket at [github.com/muratguzel/rateit/issues](github.com/muratguzel/rateit/issues)
+If you find bugs please open a ticket at [github.com/muratguzel/letsrate/issues](github.com/muratguzel/letsrate/issues)
@@ -1,17 +1,17 @@
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
-require "rateit/version"
+require "letsrate/version"
Gem::Specification.new do |s|
- s.name = "rateit"
- s.version = Rateit::VERSION
+ s.name = "letsrate"
+ s.version = Letsrate::VERSION
s.authors = ["Murat GUZEL"]
s.email = ["guzelmurat@gmail.com"]
s.homepage = ""
s.summary = %q{Provides the best solution to add rating functionality to your models.}
s.description = %q{Provides the best solution to add rating functionality to your models.}
- s.rubyforge_project = "rateit"
+ s.rubyforge_project = "letsrate"
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
File renamed without changes.
@@ -1,5 +1,5 @@
require 'rails/generators/migration'
-class RateitGenerator < Rails::Generators::NamedBase
+class LestrateGenerator < Rails::Generators::NamedBase
include Rails::Generators::Migration
source_root File.expand_path('../templates', __FILE__)
@@ -10,7 +10,7 @@ def copying
copy_file 'star-on.png', 'app/assets/images/star-on.png'
copy_file 'star-off.png', 'app/assets/images/star-off.png'
copy_file 'star-half.png', 'app/assets/images/star-half.png'
- copy_file 'rateit.js', 'app/assets/javascripts/rateit.js.erb'
+ copy_file 'letsrate.js', 'app/assets/javascripts/letsrate.js.erb'
copy_file 'rater_controller.rb', 'app/controllers/rater_controller.rb'
end
View
@@ -0,0 +1,7 @@
+require "letsrate/version"
+require "letsrate/model"
+require "letsrate/helpers"
+
+module Lestrate
+
+end
File renamed without changes.
@@ -1,8 +1,7 @@
require 'active_support/concern'
-module Rateit
+module Letsrate
extend ActiveSupport::Concern
-
def rate(stars, user_id, dimension=nil)
if can_rate? user_id, dimension
rates(dimension).build do |r|
@@ -25,7 +24,7 @@ def update_rate_average(stars, dimension=nil)
avg.qty = 1
avg.dimension = dimension
avg.save!
- end
+ end
else
a = average(dimension)
a.avg = (a.avg + stars) / (a.qty+1)
@@ -48,7 +47,7 @@ def can_rate?(user_id, dimension=nil)
true
else
false
- end
+ end
end
def rates(dimension=nil)
@@ -69,11 +68,11 @@ def raters(dimension=nil)
module ClassMethods
- def rateit_rater
+ def letsrate_rater
has_many :ratings_given, :class_name => "Rate", :foreign_key => :rater_id
end
- def rateit_rateable(*dimensions)
+ def letsrate_rateable(*dimensions)
has_many :rates_without_dimension, :as => :rateable, :class_name => "Rate", :dependent => :destroy, :conditions => {:dimension => nil}
has_many :raters_without_dimension, :through => :rates_without_dimension, :source => :rater
@@ -98,5 +97,5 @@ def rateit_rateable(*dimensions)
end
class ActiveRecord::Base
- include Rateit
+ include Letsrate
end
@@ -0,0 +1,3 @@
+module Letsrate
+ VERSION = "1.0.6.alpha"
+end
View
@@ -1,7 +0,0 @@
-require "rateit/version"
-require "rateit/model"
-require "rateit/helpers"
-
-module Rateit
-
-end
@@ -1,3 +0,0 @@
-module Rateit
- VERSION = "1.0.5.alpha"
-end
Binary file not shown.
View
Binary file not shown.

0 comments on commit 5f76981

Please sign in to comment.