Git Product home page Git Product logo

ajaxful-rating's People

Contributors

alexhayes avatar andypayne avatar bborn avatar bbwharris avatar edgarjs avatar haarts avatar sergei-matheson avatar siannopollo avatar treble37 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ajaxful-rating's Issues

Mongomapper

would be great to have this nice plugin working for mongomapper as weel.

2.2.1.1 & jruby sorting problem in AjaxfulRating::wrapper_dom_id()

Hello,
I had a problem with jruby (unrelated?) that the id's in the page source and the replacement after a rating update did not match. I changed the code a bit and it works for me now:

--- ajaxful-rating-2.2.1.1/lib/axr/model.rb~ 2010-03-08 21:21:27.000000000 -0800
+++ ajaxful_rating-2.2.1.1/lib/axr/model.rb 2010-03-08 21:20:43.000000000 -0800
@@ -90,13 +90,13 @@
options = options.symbolize_keys.slice(:small, :dimension)
options = options.map do |k, v|
if k == :dimension

  •      v
    
  •      v.to_s
     else
       v.to_s == 'true' ? k.to_s : "no-#{k}"
     end
    
    end
    prefix = "ajaxful_rating"
  •  prefix << "_#{options.join('_')}" unless options.empty?
    
  •  prefix << "_#{options.sort.join('_')}" unless options.empty?
    
    ApplicationController.helpers.dom_id(self, prefix)
    end

qeustion about rating in print

Hi! It occurs to me that when I try to print the web page, the rating does not look nice, i.e. it's 10 line s of number with underline instead of somewhat a horizontal bar.

I don't know how to solve the problem, would you please give some advices?

Inline stars

I would like to inline the stars right next to the previous element in the HTML
I am using this HAML

  • @tracks.each do |track|
    %h2
    =link_to(track.title, track)
    =ratings_for(track, :wrap => false, :small => true)

And it keeps putting the rating below the link to the track.

custom image width for custom stars (feature request)

we need a custom star width option (default is 25px) to handle a custom star image. for now we hacked the gem and change the line 62 in stars_builder.rb (function ratings_tag) to handle our image/css correctly.

SQLException

SQLite3::SQLException: no such column: rates.user_id: SELECT sum("rates".stars) AS sum_stars FROM "rates" WHERE ("rates".user_id = 5)

Does this project interfere with clearance gem?

Aggregate ratings

Hey again. Just wonder if there is any way to aggregate ratings for multiple objects. Here's an example...

I have a course object which has several rateable lessons. I don't want to make a course rateable, but I do want to be able to display an "overall rating" for the course which is simply the average rating across lessons (if there are three lessons with ratings of 5, 2, and 1 then I would want to be able to display 2.7 stars.

Alternatively, if there's a method that I can pass in a value and just have it display that in stars, I know how to calculate this average beforehand and could just pass it to this method. Do either of these functionalities exist?

RJS Error

Hello,

I've just updated from 2.1.3 to 2.2.4. I have executed again the ajaxful_rating generator, I have updated the database, the images and the stylesheet.

Everithing is working but when I try to rate an object, it raises a pop up that says:

    RJS error:

   TypeError: element is null

And then a second pop up that says:
Element.update("_ajaxful_rating_no-small_publication_2", "<ul class="ajaxful-rating"><li class="show-value" style="width: 80.0%">Global rating average: 4.0 out of 5

  • <a class="stars-1" href="#" onclick="new Ajax.Request('/publications/2/rate', {asynchronous:true, evalScripts:true, method:'post', parameters:'dimension=&show_user_rating=false&small=false&stars=1' + '&authenticity_token=' + encodeURIComponent('oJ6sB5YMQPgws7HCtvHhcJ9y5I91gc5gKQE7XEN6o6c=')}); return false;" title="Rate 1 out of 5">1
  • <a class="stars-2" href="#" onclick="new Ajax.Request('/publications/2/rate', {asynchronous:true, evalScripts:true, method:'post', parameters:'dimension=&show_user_rating=false&small=false&stars=2' + '&authenticity_token=' + encodeURIComponent('oJ6sB5YMQPgws7HCtvHhcJ9y5I91gc5gKQE7XEN6o6c=')}); return false;" title="Rate 2 out of 5">2
  • <a class="stars-3" href="#" onclick="new Ajax.Request('/publications/2/rate', {asynchronous:true, evalScripts:true, method:'post', parameters:'dimension=&show_user_rating=false&small=false&stars=3' + '&authenticity_token=' + encodeURIComponent('oJ6sB5YMQPgws7HCtvHhcJ9y5I91gc5gKQE7XEN6o6c=')}); return false;" title="Rate 3 out of 5">3
  • <a class="stars-4" href="#" onclick="new Ajax.Request('/publications/2/rate', {asynchronous:true, evalScripts:true, method:'post', parameters:'dimension=&show_user_rating=false&small=false&stars=4' + '&authenticity_token=' + encodeURIComponent('oJ6sB5YMQPgws7HCtvHhcJ9y5I91gc5gKQE7XEN6o6c=')}); return false;" title="Rate 4 out of 5">4
  • <a class="stars-5" href="#" onclick="new Ajax.Request('/publications/2/rate', {asynchronous:true, evalScripts:true, method:'post', parameters:'dimension=&show_user_rating=false&small=false&stars=5' + '&authenticity_token=' + encodeURIComponent('oJ6sB5YMQPgws7HCtvHhcJ9y5I91gc5gKQE7XEN6o6c=')}); return false;" title="Rate 5 out of 5">5
  • ");
    new Effect.Highlight("_ajaxful_rating_no-small_publication_2",{});

    After that, the stars remain blank, but when I reload the page, I realize that the rating has been stored.

    Any suggestion??

    Thank you very much in advance, keep up this great work!!

    RJS Error

    I had previously used the edgarjs-ajaxful_rating gem. I'm now trying to get setup with the new ajaxful_rating gem and I'm running into an issue. When I rate an article I receive an RJS error.

    Element.update("ajaxful-rating-link-8167", "<ul class="ajaxful-rating"><li class="show-value" style="width: 80.0%">Global rating average: 4.0 out of 5

  • <a class="stars-1" href="#" onclick="new Ajax.Request('/links/8167/rate', {asynchronous:true, evalScripts:true, method:'post', parameters:'dimension=&show_user_rating=false&small=false&stars=1' + '&authenticity_token=' + encodeURIComponent('I79P1IT8pNoG/zDZReMhQmjlw3TYAAjhoF3/ms4LHDQ=')}); return false;" title="Rate 1 out of 5">1
  • <a class="stars-2" href="#" onclick="new Ajax.Request('/links/8167/rate', {asynchronous:true, evalScripts:true, method:'post', parameters:'dimension=&show_user_rating=false&small=false&stars=2' + '&authenticity_token=' + encodeURIComponent('I79P1IT8pNoG/zDZReMhQmjlw3TYAAjhoF3/ms4LHDQ=')}); return false;" title="Rate 2 out of 5">2
  • <a class="stars-3" href="#" onclick="new Ajax.Request('/links/8167/rate', {asynchronous:true, evalScripts:true, method:'post', parameters:'dimension=&show_user_rating=false&small=false&stars=3' + '&authenticity_token=' + encodeURIComponent('I79P1IT8pNoG/zDZReMhQmjlw3TYAAjhoF3/ms4LHDQ=')}); return false;" title="Rate 3 out of 5">3
  • <a class="stars-4" href="#" onclick="new Ajax.Request('/links/8167/rate', {asynchronous:true, evalScripts:true, method:'post', parameters:'dimension=&show_user_rating=false&small=false&stars=4' + '&authenticity_token=' + encodeURIComponent('I79P1IT8pNoG/zDZReMhQmjlw3TYAAjhoF3/ms4LHDQ=')}); return false;" title="Rate 4 out of 5">4
  • <a class="stars-5" href="#" onclick="new Ajax.Request('/links/8167/rate', {asynchronous:true, evalScripts:true, method:'post', parameters:'dimension=&show_user_rating=false&small=false&stars=5' + '&authenticity_token=' + encodeURIComponent('I79P1IT8pNoG/zDZReMhQmjlw3TYAAjhoF3/ms4LHDQ=')}); return false;" title="Rate 5 out of 5">5
  • ");
    new Effect.Highlight("ajaxful-rating-link-8167",{});

    The error appears to be caused by my div id...

    undefined local variable or method 'ajaxful_rater' under mod_rails, rails 2.3.8, ruby 1.8.7

    The title essentially says it all. mod_rails won't boot my app because of this. I thought it was because I wasn't vendorizing my gems, but having verifying that I've now done that correctly, I still get the error:

    undefined local variable or method 'ajaxful_rater' under mod_rails, rails 2.3.8, ruby 1.8.7, debian

    and am now quite simply at a loss. Shutting off ajaxful-rating and taking out all references to it result in the app starting up. At the same time, this is not an issue under ruby 1.9.2/webrick, so I'm not sure what the weak pt is here.

    Rating not updated without page refresh

    Hi,

    At present in my app the rating is not being updated after clicking on the stars, although the value is being recorded as after a page refresh the new rating appears. In my view:

    Average: <%= ratings_for @place, :static %></br>
    Your Rating: <%= ratings_for @place, @user, :show_user_rating => true %>
    

    Which generates:

    Average: <div class="ajaxful-rating-wrapper" id="ajaxful_rating_no-small_place_2"><ul      class="ajaxful-rating"><li class="show-value" style="width: 50.0%">Global rating average: 2.5 out of 5</li><li><span class="stars-1" title="Global rating average: 2.5 out of 5">2.5</span></li><li><span class="stars-2" title="Global rating average: 2.5 out of 5">2.5</span></li><li><span class="stars-3" title="Global rating average: 2.5 out of 5">2.5</span></li><li><span class="stars-4" title="Global rating average: 2.5 out of 5">2.5</span></li><li><span class="stars-5" title="Global rating average: 2.5 out of 5">2.5</span></li></ul></div></br>
    

    Your Rating:

    • Your rating: 1 out of 5
    • 1
    • 2
    • 3
    • 4
    • 5

    I'm using Ruby 1.9.1 and Rails 3.0.0beta3 with jQuery, any help would be much appreciated! Awesome plugin btw...

    usage of rails_xss plugin with rails 2.3.8 break output

    under rails 2.3.8 (ruby 1.9.1) the usage of the rails_xss plugin (adviced by rails core team) the output break and is escaped.

    any solution? for now i "hacked" the gem directly and add an html_safe! in the function ratings_tag to the stars.join

    The {{key}} interpolation syntax in I18n messages is deprecated. Please use %{key} instead

    Hi,

    With rails3 I get this message

    The {{key}} interpolation syntax in I18n messages is deprecated. Please use %{key} instead.
    /Library/Ruby/Gems/1.8/gems/i18n-0.4.1/lib/i18n/backend/base.rb:162:in `interpolate'
    /Library/Ruby/Gems/1.8/gems/i18n-0.4.1/lib/i18n/backend/base.rb:157:in `gsub'
    /Library/Ruby/Gems/1.8/gems/i18n-0.4.1/lib/i18n/backend/base.rb:157:in `interpolate'
    /Library/Ruby/Gems/1.8/gems/i18n-0.4.1/lib/i18n/backend/base.rb:197:in `preserve_encoding'
    /Library/Ruby/Gems/1.8/gems/i18n-0.4.1/lib/i18n/backend/base.rb:156:in `interpolate'
    /Library/Ruby/Gems/1.8/gems/i18n-0.4.1/lib/i18n/backend/base.rb:49:in `translate'
    /Library/Ruby/Gems/1.8/gems/i18n-0.4.1/lib/i18n.rb:152:in `t'
    /Library/Ruby/Gems/1.8/bundler/gems/ajaxful-rating-85221d1/lib/axr/locale.rb:26:in `i18n'
    /Library/Ruby/Gems/1.8/bundler/gems/ajaxful-rating-85221d1/lib/axr/stars_builder.rb:65:in `ratings_tag'
    /Library/Ruby/Gems/1.8/bundler/gems/ajaxful-rating-85221d1/lib/axr/stars_builder.rb:111:in `wrapper_tag'
    /Library/Ruby/Gems/1.8/bundler/gems/ajaxful-rating-85221d1/lib/axr/stars_builder.rb:23:in `render'
    /Library/Ruby/Gems/1.8/bundler/gems/ajaxful-rating-85221d1/lib/axr/helpers.rb:83:in `ratings_for'
    

    To avoid it I had to change lib/axr/locale.rb like this:

        DEFAULTS = {
          :user_rating => "Your rating: %{value} out of %{max}",
          :global_average => "Global rating average: %{value} out of %{max}",
          :hover => "Rate %{value} out of %{max}"
        }
    

    May be you could commit a fix with this ?

    Thx.

    no rating_average

    I impleneted ajaxful rating on a Store model with 3 dimensions. I am
    caching rating average for each dimension as well as the overall
    average rating. The individual dimension rates are being saved and
    shown correctly (including average per dimension) and everything works fine except, the "rating_average"
    does not update (still at 0) even after multiple users have updated it
    for a specific record.

    SQL errors with MySQL

    I'm testing out the demo app. It works fine with sqlite3, but blows up in spots when using MySQL. For example:

    car.raters
    ActiveRecord::StatementInvalid: Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[id] = r.[user_id] WHERE r.[rateable_id] = 1 AND r.[rateable_type] = 'Car'' at line 1: SELECT DISTINCT u.* FROM users u INNER JOIN rates r ON u.[id] = r.[user_id] WHERE r.[rateable_id] = 1 AND r.[rateable_type] = 'Car'

    I'm slightly behind on mysql version, fyi (5.0.51a). Perhaps that's related.

    MissingRateRoute error - the other solutions all done

    I have checked the other issues with MissingRateRoute errors and I am compliant with all results.

    Users are raters and rateable. The user controller reads:

    def rate
    @user = @object_to_be_rated
    @user.rate(params[:stars], @winner.user, params[:dimension])
    #AJAX page building
    render :update do |page|
    page.replace_html @user.wrapper_dom_id(params), ratings_for(@user, params.merge(:wrap => false))
    page.visual_effect :highlight, @user.wrapper_dom_id(params)
    end
    end

    The routes.rb has the line:

    map.resources :users, :member => {:rate => :post}

    The view shows:

    <%= ratings_for @object_to_be_rated, @current_user, :show_user_rating => true, :wrap => false, :allow_update => true, :dimension => :seller_rating, :method => :post %>

    I am ready to give up. Cannot fathom what else to do...

    html_safe breaaks from 2.2.6 to 2.2.8

    I just updated the gem from 2.2.6. to 2.2.8 in a production application and my cucumber test starting breaking with this error

    undefined method `html_safe' for #<String:

    when doing <%= ratings_for @document, :static %>

    Like I said this was a working application with 2.2.6, any guidance on how to fix this?

    this is my environment.rb

    config.gem "formtastic"
    config.gem "authlogic"
    config.gem 'mislav-will_paginate', :version => '~> 2.3.11', :lib => 'will_paginate',
    :source => 'http://gems.github.com'
    config.gem 'thoughtbot-paperclip', :lib => 'paperclip', :source => 'http://gems.github.com'
    config.gem 'sitemap_generator', :lib => false, :source => 'http://gemcutter.org'
    config.gem 'pdf-toolkit', :lib => 'pdf/toolkit'
    config.gem "ajaxful_rating", :version => '2.2.6'

    Show only the user rates.

    IS there any way of showing only the current user rates with

    rates_for @model, :dimension=>:x ?

    Or it will always bring together the average of all votes?

    Tks!

    Access to number of ratings

    I apologize if I'm missing something, but it seems like the rating system would be much more suited for practical use if the number of ratings is accessible.

    For example, a user might want to know if 100 people have given an article a good rating, in which case the recommendation is very reliable, vs one person, in which case the recommendation is not as reliable.

    calling ajaxful_rating_style within a view file doesn't generate all the CSS

    When you call <%= ajaxful_rating_style %> inside your layout file it works fine. But if I try calling it inside a view file like this:

    <% content_for :header do %>
    <%= ajaxful_rating_style %>
    <% end %>

    it doesn't work as expected. I can see in the README file that you do state it's necessary to put it into your layout file. Anyway I suggest you could call it within a view file, just the way I showed. That way you don't have to always include the CSS file in all the controllers and actions that use that layout.

    In the meantime you should make more emphasis about this in the documentation because it took me a while to figure out why the helper method wasn't generating the dynamic part of the CSS.

    PD: Great work

    Question about number of ratings for an object?

    I am setting up a way for users to rate other users and want to display how many ratings the average is out of. Is there an easy way to find the number of ratings for a particular object?

    any thoughts on using this without a user model?

    we have a site that we can't require logins for, but needs to have ratings. it would be fine if every rating was cookie based or something, or even if was completely open (anyone can put in a rating, as many times as they wanted to).

    Ratings disappear on show/hide (2.2.8.2)

    Ratings disappear when the div that they appear in are hidden via a simple jQuery('.blah').hide(); In other words when calling 'show' on the same div, the rating do not show up. They are still there in the HTML but are no longer styled, so I suppose this is some kind of CSS issue?
    Is there any way around this?
    I am running 2.2.8.2 with Rails 2.3.8.

    Too Much Duplicate CSS

    I'm implementing ajaxful-rating for the first time, and it generates hundreds of lines of duplicate css when calling ajaxful_rating_style.

    uninitialized constant

    Hi,
    I followed the installation instruction but I get an error n every page of my web site.
    Here is the error:
    uninitialized constant Defi::Rate

    Log:
    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:105:in const_missing' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:2199:incompute_type'
    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/kernel/reporting.rb:11:in silence_warnings' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:2195:incompute_type'
    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/reflection.rb:156:in send' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/reflection.rb:156:inklass'
    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/reflection.rb:187:in quoted_table_name' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations.rb:1416:inconfigure_dependency_for_has_many'
    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations.rb:824:in has_many' (eval):3:inhas_many'
    /Library/Ruby/Gems/1.8/gems/ajaxful_rating-2.2.4/lib/axr/model.rb:21:in ajaxful_rateable' /Users/gregorymarcilhacy/Documents/projets/trunk-capoupascap/app/models/defi.rb:2 /Users/gregorymarcilhacy/Documents/projets/trunk-capoupascap/app/controllers/home_controller.rb:4:inindex'

    Any idea why?

    upgrading to 2.2

    I was using v2.1.5 but upgraded to take advantage of some of your improvements. I'm getting the error the below error when I try to rate an object.

    NoMethodError (undefined method `rater=' for #Rate:0x106fc82b0):

    What do I need to change from my old version to make it work with the new? I manually changed user_id to rater_id in the Rates table, but what else should I do?

    BTW, the above error only occurs when trying to rate something with no rating so far. If you update an existing rating there is no error.

    Thanks.

    jquery support?

    i have gotten the gem to work in its own app
    but when combined with an existing app using jquery, things fall apart quickly
    i noticed a framework => jquery setting, but not sure where to apply it

    delete rating

    Suppose a user has delete an item which was ratable. How do I delete the rating?

    Hi, not able to submit rates....

    Hi, I followed the instructions...needed to add a rake db:migrate that wasn't there...but anyway...I can display the rates when I put it into the show...but how do I submit? No ajax behavior occurs when I mouse over it....am I missing something?

    I checked out the demo....just saw code in the show -- and I added the def rate to the ratedobject model.

    Star not updated after rating

    Let's say you have the following in your view:
    <%= ratings_for @Publication, :show_user_rating => true %>
    When you submit a rating, the number of stars does not change. But if you reload the page, you notice that the rating has been successfully submited - number of stars has changed.

    Workaround:
    <%= ratings_for @Publication, :show_user_rating => true,:dimension => nil %>

    Cause of the bug:
    @rated_model.wrapper_dom_id({"small"=>"false", "id"=>"5", "stars"=>"1", "dimension"=>""} )
    => "_ajaxful_rating_no-small_publication_1"

    @rated_model.wrapper_dom_id({"small"=>"false", "id"=>"5", "stars"=>"1"} )
    => "ajaxful_rating_no-small_publication_1"

    Notice that the second method call returns a string that does not begin with an underscore, because the parameter dimension is nil.

    still not able to actually rate -- stars remain blank

    In my Vendors Controller I put the following method:

    def rate
    @vendor.rate(params[:stars], current_user, params[:dimension])
    id = "ajaxful-rating-#{!params[:dimension].blank? ? "#{params[:dimension]}-" : ''}vendor-#{@vendor.id}"
    render :update do |page|
    page.replace_html id, ratings_for(@Vendor, :wrap => false, :dimension => params[:dimension], :small_stars => params[:small_stars])
    page.visual_effect :highlight, id
    end
    end

    I then display in the view#show:
    <%= ratings_for @Vendor %>

    I can mouse over it and see that it is 0.0/4.0 but there isn't a way to actually submit a rating.

    escaping HTML

    With Ruby 1.9.1 on Rails 3 when I call helper ratings_for all the

  • tags are changed to <li>
    It appears that in function AjaxfulRating::StarsBuilder::ratings_tag when calling stars.join in the last line stars are converted from ActiveSupport::SafeBuffer to String which later causes escaping.
    My workaround - concatenate them instantly without array and join:
    def ratings_tag
    width = (show_value / rateable.class.max_stars.to_f) * 100
    li_class = "axr-#{show_value}-#{rateable.class.max_stars}".gsub('.', '_')
    @css_builder.rule('.ajaxful-rating', :width => (rateable.class.max_stars * 25))
    @css_builder.rule('.ajaxful-rating.small',
    :width => (rateable.class.max_stars * 10)) if options[:small]

      stars = @template.content_tag(:li, i18n(:current), :class => "show-value", :style => "width: #{width}%")
      (1..rateable.class.max_stars).each do |i|
        stars << star_tag(i)
      end
      @template.content_tag(:ul, stars, :class => "ajaxful-rating#{' small' if options[:small]}")
    end
    
  • Rate model should be named Rating

    Wouldn't that be a better name?
    Could you add support for renaming the model in the options hash given to ajaxful_rateable?

    ajaxful_rateable :class_name=>'Rating'

    as it is already possible to customize the class_name in
    ajaxful_rater

    can't install gem on rails 3

    I'm a rails newbies so please forgive me if i'm doing something stupid.

    I am trying to install the rails 3 beta of ajaxful_rating by doing 'gem install ajaxful_rating --pre', it says it installed. but i can't find the generators anywhere?

    undefined local variable or method `ajaxful_rateable'

    Hi there
    Can someone help me with this plz. I typed: ruby script/plugin install git://github.com/edgarjs/ajaxful-rating.git to install the plugin, then it just returned an new line, and it also creates a empty fold in the vendor\plugins\ajaxful-rating. As I follow the instructions I get "undefined local variable or method `ajaxful_rateable' for", It looks like the plugin never installed..
    Thx

    How are individual ratings stored?

    Hi, where does one store the individual ratings for a given item? It wasn't clear from documentation as to where this data is stored.

    Thanks in advance,

    -Conrad

    Uninitialized Constant

    getting "uninitialized constant AjaxfulRating::StarsBuilder::MissingRateRoute" on show, new, and edit

    my models are "Source" and "User" and I have in my routes "map.resources :sources, :user => {:rate => :post}"

    Any ideas? Thanks!

    Slight README Typo

    This line has fancy quotes instead of normal ones:

    id = "ajaxful-rating-#{!params[:dimension].blank? ? “#{params[:dimension]}-” : ’’}article-#{@article.id}"
    

    rater_id not getting updated.

    Hi,

    I have upgraded from gem version edgarjs-ajaxful_rating (2.1.3) to gem ajaxful_rating (2.2.8.2). I replaced user_id for the rater_id field. When updating as such:

    INSERT INTO rates (rateable_type, created_at, rateable_id, rater_id, updated_at, stars, dimension) VALUES('Match', '2010-11-27 17:28:31', 4197, NULL, '2010-11-27 17:28:31', 4, 'technical')

    The issue is that the rater_id is not getting populated. I inserted a new column in the table: user_id and the user_id field is getting populated by the rater_id is not.

    I installed the plugin and worked with the code and was able to get this to work was by adding:

    def rate(stars, user, dimension = nil)
      return false if (stars.to_i > self.class.max_stars)
      raise AlreadyRatedError if (!self.class.axr_config[:allow_update] && rated_by?(user, dimension))
    
      rate = if self.class.axr_config[:allow_update] && rated_by?(user, dimension)
        rate_by(user, dimension)
      else
        returning rates(dimension).build do |r|
          r.rater = user
        end
      end
      rate.rater_id = user.id  # code added by raul padilla
      rate.stars = stars
      rate.save!
      self.update_cached_average(dimension)
    end
    

    Can't tell you if I have something that may be causing this not to work as you intended but as I have done it seems to work for me. Is it possible to add this to the gem?

    Hope it helps or you can help me. Thanks for your plugin.

    Raul Padilla

    Rating possible but no page update

    Hi,

    I have implemented the ajaxful-rating and I am able to rate my model. BUT I don’t get any page update. in order to see the applied rating I have to reload the page.

    Admittedly, I am using the ajaxful-rating gem under rather complicated circumstances:

    1. I rate users, so the the model that is rating is ratable at the same time
    2. I use the rating feature in an admin name space
    3. the admin name space uses active scaffold for the controller and view logic.
    4. rails 2.3.8 and ruby 1.8.7, gem version is 2.2.8.1

    I am able to display the global rating and under that the rating of that particular user using the following code in my view:

      
    Avarage Rating:
    <%= ratings_for @record, :static, :remote_options => {:url => ate_admin_user_path(@record)} %>
    Your Rating:
    <%= ratings_for @record, :show_user_rating => true, :remote_options => {:url => rate_admin_user_path(@record)} %>

    I do get the hover effect when mousing over the stars due to including <%= ajaxful_rating_style %> in my layout file.
    When clicking a star the rating is kind of indicated by keeping number of rated stars in the hover state (red/orange). The rating does take place due to my controller functions:

    def rate
    @record = User.find(params[:id])
    @record.rate(params[:stars], current_user, params[:dimension])
    render :update do |page|
      page.replace_html @record.wrapper_dom_id(params), ratings_for(@record, params.merge(:wrap => false))
      page.visual_effect :highlight, @record.wrapper_dom_id(params)
    end
    end
    

    The rating is applied and the average is calculated which can be seen upon reloading the page. But the ajax part of updating the star rating upon click does not happen. Instead I do get the following error in the logs:

      NameError (Constant AjaxfulRating::MissingRateRoute from   ajaxful_rating/missing_rate_route.rb not found
      Constant MissingRateRoute from missing_rate_route.rb not found):
        desert (0.5.1) lib/desert/rails/dependencies.rb:56:in `look_for_constant_in_parent_module'
        desert (0.5.1) lib/desert/rails/dependencies.rb:13:in `load_missing_constant'
        /home/helmerj/.rvm/gems/ree-1.8.7-2010.02/gems/aws-s3-0.6.2/lib/aws/s3/extensions.rb:206:in `const_missing'
        /home/helmerj/.rvm/gems/ree-1.8.7-2010.02/gems/ajaxful_rating-2.2.8.1/lib/axr/stars_builder.rb:52:in `apply_stars_builder_options!'
        /home/helmerj/.rvm/gems/ree-1.8.7-2010.02/gems/ajaxful_rating-2.2.8.1/lib/axr/stars_builder.rb:10:in `initialize'
        /home/helmerj/.rvm/gems/ree-1.8.7-2010.02/gems/ajaxful_rating-2.2.8.1/lib/axr/helpers.rb:82:in `new'
        /home/helmerj/.rvm/gems/ree-1.8.7-2010.02/gems/ajaxful_rating-2.2.8.1/lib/axr/helpers.rb:82:in `ratings_for'
        app/controllers/admin/users_controller.rb:125:in `rate'
        app/controllers/admin/users_controller.rb:124:in `rate'
        haml (3.0.15) lib/sass/plugin/rack.rb:41:in `call'
    
        Rendered rescues/_trace (71.6ms)
        Rendered rescues/_request_and_response (0.5ms)
        Rendering rescues/layout (internal_server_error)
    

    My routes for this rating looks like this:

      map.namespace :admin do |admin|
        admin.resources :users, :member => {:rate => :post}, :active_scaffold => true
      end
    

    I am so close, any help on this would be greatly appreciated.

    Cheers J.

    Display the rate for a user

    Hello,

    given that I have an article with n users who have rated the article, I would like to be able to list all the user with their rate. something like that:
    <% @article.rates.users.each do |user| %>
    <%= ratings_for @Article, :static, user, :show_user_rating => true %>
    <% end %>
    and the stars being :static
    is there a way to do that?
    Thanks

    users cannot be rateable

    While working on a project, I wanted it to work so that a user can rate another user. But I wasnt able to do it. The rateable_id and rateable_type dont get saved to the database for some reason.
    Is it possible to have the user model as both the rater and rateable?
    Please let me know if I've missed something.

    cant submit Submit Votes

    Hello, I've just installed and set up this nice plugin.
    In my view I have
    <%= ratings_for @recipe, @logged_in, :static,:remote_options => {:url => 'recipes/rate/' + @recipe.id.to_s} %>
    Person is the rater, Recipe is to be rated.
    Its displaying a row of stars (like 40) and I cant click on any of them to submit my vote.
    Can this be used w/out any dimensions? just rate the enitre model?
    Thanks!

    Multiple ratings_for on one page

    Hi,

    On one of my views, I call ratings_for on like objects found via a block. If there are more than one objects found, the stars display fine for each one. However, when submitting a rating for any of these itemts, the stars for the first item change while the stars that should be associated with the item do not.

    However, the ratings seems to submit fine for every item after the first. However, the first item will rate once and then never update if its stars are changed.

    spaces in dimension names

    Is it ok to have dimensions like "Product And Service Quality"?

    If yes, what would be the cached average rating column name?

    Thanks

    Recommend Projects

    • React photo React

      A declarative, efficient, and flexible JavaScript library for building user interfaces.

    • Vue.js photo Vue.js

      🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

    • Typescript photo Typescript

      TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

    • TensorFlow photo TensorFlow

      An Open Source Machine Learning Framework for Everyone

    • Django photo Django

      The Web framework for perfectionists with deadlines.

    • D3 photo D3

      Bring data to life with SVG, Canvas and HTML. 📊📈🎉

    Recommend Topics

    • javascript

      JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

    • web

      Some thing interesting about web. New door for the world.

    • server

      A server is a program made to process requests and deliver data to clients.

    • Machine learning

      Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

    • Game

      Some thing interesting about game, make everyone happy.

    Recommend Org

    • Facebook photo Facebook

      We are working to build community through open source technology. NB: members must have two-factor auth.

    • Microsoft photo Microsoft

      Open source projects and samples from Microsoft.

    • Google photo Google

      Google ❤️ Open Source for everyone.

    • D3 photo D3

      Data-Driven Documents codes.