search for: rateable_id

Displaying 6 results from an estimated 6 matches for "rateable_id".

2006 Dec 11
1
Using link_to_remote to add a record
...''ve seen some examples of this being done but can''t seem to get it to work. Any ideas about what I''m doing wrong? Here is what I have in my view: <%= link_to_remote( "1", {:url => { :controller => "ratings", :action => "rate", :rateable_id => "1", :rating => "1", :rateable_type => "article"}}) %> Here is what I have in RatingsController: def rate @rating = Rating.new(:rateable_id => params[:rateable_id], :rating => params[:rating],...
2006 Sep 23
8
acts_as_rateable plugin help!
Hello, I am having some trouble figuring out how to use the rateable plugin. i followed as close as the directions located at http://www.naffis.com/blog/articles/2006/08/31/rails-ajax-star-rating-system but i fail at working it. i am getting this error You have a nil object when you didn''t expect it! The error occured while evaluating nil.rating Extracted source (around line #1): 1:
2007 Apr 13
0
mixin behavior
...a different table for each set of summary data. So I defined a module (messy, I know): --- module RatingTotals::StoryRatingTotals def refresh_story_totals(date = Date.new(2007, 1, 1)) # Removed most the code. ratings = Rating.find(:all, :select => ''rateable_id, AVG(rating) as average_rating, COUNT(id) as count '', :conditions => ["rateable_type = ''story'' AND created_at >= ? ", date], :group => ''rateable_id '') totals = [] ratings.eac...
2008 Aug 27
5
VALIDATION QUESTION
...nt (the field name) in both the furnii model and the ratecomment model but it does not work. I know there are ways around this, suggestions anyone? #########controller code def rate @furnii = Furni.find(params[:id]) Rating.delete_all(["rateable_type = ''Furni'' AND rateable_id = ?", @furnii]) @furnii.add_rating Rating.new(:rating => params[:ratecomment]["rating"]) @comments = Ratecomment.new(params[:ratecomment]) if @comments.save redirect_to furni_path(@furnii) end end -- Posted via http://www.ruby-forum.com/. --~...
2007 Jun 04
1
acts_as_rateable in Beast
...I''ve added acts_as_rateable to my posts model and I''ve added this method to my controller: def vote_up return unless logged_in? rateable = @rateable_class.find(params[:id]) # Delete the old ratings for current user Rating.delete_all(["rateable_type = ? AND rateable_id = ? AND user_id = ?", @rateable_class.base_class.to_s, params[:id], @current_user.id]) rateable.add_rating Rating.new(:rating => 1, :user_id => @current_user.id) end Is there a way to dynamically update (ajax) the rating in my view without having to refresh the page? I''...
2008 Jul 01
2
rateable plugin problem
...le? page.replace_html “star-ratings-block”, :partial => ‘rating/rating’, :locals => { :picture=> @picture } Code at controller looks like: ------------------------------ def rate @picture = Picture.find(params[:id]) Rating.delete_all(["rateable_type = ''Picture'' AND rateable_id = ? AND user_id = ?", @picture.id, current_user.id]) @picture.add_rating Rating.new(:rating => params[:rating], :user_id => current_user.id) end end Any help would be appreciated. thanks. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ Y...