muratguzel / letsrate

The best way to add rating capabilities to your rails application and your activerecord models.
http://letsrate.herokuapp.com
198 stars 234 forks source link

Added rerating options and fixed two bugs #47

Closed ElvinEfendi closed 10 years ago

ElvinEfendi commented 10 years ago

Fixed bugs:

Rerating functionality: Now developers can toggle between allowing rerating and no allowing but sending flag while calling letsrate_rateable method

Added documentation for using allow_rerating flag

yozzz commented 10 years ago

Hi, can you say me please, how can I set readonly option for specific rating_for field and make that user can rate only ones?

ElvinEfendi commented 10 years ago

Hi, @yozzz. If you are using my fork you can do it as follow: rating_for @your_object, "dimension", {disable_after_rate: false}

yozzz commented 10 years ago

Sorry for question... you have two main folders generators and letsrate. From generators/letsrate/templates I copied two files as letsrate.js.coffee.erb and rater_controller.rb. In main folder letsrate you have files as helpers.rb, model.rb and version.rb , where I should put it with file letsrate.rb that requires them? After installing gem I don't see similar files. Thank you for understanding! :)

ElvinEfendi commented 10 years ago

@yozzz you do not need to copy any file. Just install the gem as follow and use the helper in a way I mentioned above: gem 'letsrate', git: "https://github.com/ElvinEfendi/letsrate.git"

yozzz commented 10 years ago

Thought I can't install gem from fork repository, thanks. After command rails g letsrate user getting: /home/yoz/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.13/lib/active_support/depend encies.rb:251:in `require': /home/yoz/.rvm/gems/ruby-1.9.3-p448/bundler/gems/letsrate-b ce8544a4d49/lib/letsrate/model.rb:62: syntax error, unexpected tLABEL (SyntaxError) def letsrate_rateable(*dimensions, allow_rerating: false)

ElvinEfendi commented 10 years ago

@yozzz The changes I made mistakenly was only Ruby 2.0 compatible - I had used keyword arguments. I've just corrected it and now it should work with Ruby 1.9.* as well. You can reinstall and check it again.

yozzz commented 10 years ago

I will try it thank you! Is there some way in this gem output stars that start count from one, I mean first star active by default?

muratguzel commented 10 years ago

Hi .. For a long time, I have not enough time to mange this gem. But nowadays I'm available. You can check this issue 2-3 days later. Thanks ...

ericaBradford commented 10 years ago

@ElvinEfendi In your generator file you have copy_file 'letsrate.js.cofee.erb', 'app/assets/javascripts/letsrate.js.coffee.erb'. Coffee is mispelled, causing issues.

ElvinEfendi commented 10 years ago

@ericaBradford it seems like the issues I've targeted with this pull requests are already fixed without merging anyway.

ericaBradford commented 10 years ago

@ElvinEfendi How do we change data-disable-after-rate? I can't seem to find how to fix it...

ElvinEfendi commented 10 years ago

@ericaBradford when calling rating_for or rating_for_user method just set disable_after_rate: true

check the helper methods' implementation for more info: https://github.com/muratguzel/letsrate/blob/master/lib/letsrate/helpers.rb

ericaBradford commented 10 years ago

@ElvinEfendi Thank you!!!

ericaBradford commented 10 years ago

@ElvinEfendi I don't know why, but it isn't working... <%= rating_for @recipe, "Rating", :disable_after_rate => false %> Am I doing something wrong? I'm trying to make recipes reratable, so I'm pretty sure it's supposed to be set false