Displaying 6 results from an estimated 6 matches for "rateable_type".
2006 Dec 11
1
Using link_to_remote to add a record
...'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],
:rateable_type => params[:rateable_type])
end
I foun...
2007 Jun 04
1
acts_as_rateable in Beast
...able-plugin/)
So far, 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 th...
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:
2008 Aug 27
5
VALIDATION QUESTION
...s. I tried to add validates_presence_of :content (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
--...
2008 Jul 01
2
rateable plugin problem
...view corresponds to :picture following in rjs file?
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/.
--~--~---...
2007 Apr 13
0
mixin behavior
...otals
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.each do |rating|
totals << self.new(:story_id => rating.rateable_id,
:rating => rating.a...