mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-12-26 12:30:48 +00:00
Remove acts_as_rateable
This commit is contained in:
parent
b0b103a518
commit
613fea26d4
5 changed files with 2 additions and 85 deletions
2
Gemfile
2
Gemfile
|
@ -23,6 +23,8 @@ gem 'puma'
|
||||||
# Model plugins
|
# Model plugins
|
||||||
# FIXME: using this b/c ruby 2.4 not supported
|
# FIXME: using this b/c ruby 2.4 not supported
|
||||||
gem 'unread', '0.10.1'
|
gem 'unread', '0.10.1'
|
||||||
|
# gem 'impressionist'
|
||||||
|
# gem 'ratyrate'
|
||||||
# gem "acts_as_rateable", :git => "git://github.com/anton-zaytsev/acts_as_rateable.git"
|
# gem "acts_as_rateable", :git => "git://github.com/anton-zaytsev/acts_as_rateable.git"
|
||||||
|
|
||||||
# View helper gems
|
# View helper gems
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
Copyright (c) 2007 [name of plugin creator]
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
a copy of this software and associated documentation files (the
|
|
||||||
"Software"), to deal in the Software without restriction, including
|
|
||||||
without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be
|
|
||||||
included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
@ -1,40 +0,0 @@
|
||||||
Acts As Rateble
|
|
||||||
=============
|
|
||||||
|
|
||||||
Acts_as_rateable is a plugin released under the MIT license.
|
|
||||||
It makes activerecord models rateable through a polymorphic association and optionally logs which user rated which model.
|
|
||||||
In this case, one user can rate an object once. Used on cotcot.hu for article rating, sponsored quizzes, etc.
|
|
||||||
|
|
||||||
|
|
||||||
Example
|
|
||||||
=======
|
|
||||||
|
|
||||||
Install the plugin into your vendor/plugins directory, insert 'acts_as_rateable' into your model, then restart your application.
|
|
||||||
|
|
||||||
class Post < ActiveRecord::Base
|
|
||||||
|
|
||||||
acts_as_rateable
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
Now your model is extended by the plugin, you can rate it ( 1-# )or calculate the average rating.
|
|
||||||
|
|
||||||
@post.rate_it( 4, current_user.id )
|
|
||||||
|
|
||||||
@post.average_rating #=> 4.0
|
|
||||||
|
|
||||||
@post.average_rating_round #=> 4
|
|
||||||
|
|
||||||
@post.average_rating_percent #=> 80
|
|
||||||
|
|
||||||
@post.rated_by?( current_user ) #=> rating || false
|
|
||||||
|
|
||||||
Post.find_average_of( 4 ) #=> array of posts
|
|
||||||
|
|
||||||
See acts_as_rateable.rb for further details!
|
|
||||||
|
|
||||||
# Notes
|
|
||||||
|
|
||||||
Jinzhu - generator is compatible with rails 3.
|
|
||||||
|
|
||||||
Copyright (c) 2007-2010 Ferenc Fekete, http://feketeferenc.hu , released under the MIT license
|
|
|
@ -1,22 +0,0 @@
|
||||||
require 'rake'
|
|
||||||
require 'rake/testtask'
|
|
||||||
require 'rake/rdoctask'
|
|
||||||
|
|
||||||
desc 'Default: run unit tests.'
|
|
||||||
task :default => :test
|
|
||||||
|
|
||||||
desc 'Test the acts_as_ratable plugin.'
|
|
||||||
Rake::TestTask.new(:test) do |t|
|
|
||||||
t.libs << 'lib'
|
|
||||||
t.pattern = 'test/**/*_test.rb'
|
|
||||||
t.verbose = true
|
|
||||||
end
|
|
||||||
|
|
||||||
desc 'Generate documentation for the acts_as_ratable plugin.'
|
|
||||||
Rake::RDocTask.new(:rdoc) do |rdoc|
|
|
||||||
rdoc.rdoc_dir = 'rdoc'
|
|
||||||
rdoc.title = 'ActsAsRatable'
|
|
||||||
rdoc.options << '--line-numbers' << '--inline-source'
|
|
||||||
rdoc.rdoc_files.include('README')
|
|
||||||
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
||||||
end
|
|
|
@ -1,3 +0,0 @@
|
||||||
require 'acts_as_rateable'
|
|
||||||
|
|
||||||
ActiveRecord::Base.send(:include, ActiveRecord::Acts::Rateable)
|
|
Loading…
Reference in a new issue