edgarjs / ajaxful-rating

Provides a simple way to add rating functionality to your application.
http://rdoc.info/projects/edgarjs/ajaxful-rating
418 stars 127 forks source link

How to do 'ratings_for' a new object? #82

Open ericpeters0n opened 12 years ago

ericpeters0n commented 12 years ago

How should one implement ajaxful-ratings' 'ratings_for' for a new (RESTful) object?

i.e. I'd like to call 'ratings_for' in the form that initializes an object (e.g. /microposts/new). [The object would not be persisted at this point, so the call to persist the ratings currently throws an internal server error.]

One strategy might be to override the 'ratings_for' generator to accept a flag (e.g. :new_rateable) that rendered a variation of the control that simply updated the value (# of stars) in the form, and to not execute the rating until the form is submitted.

Suggestions?