-
Notifications
You must be signed in to change notification settings - Fork 127
Rails 3.1 #56
Comments
Sorry I was wrong about this. I think there is a styling error so the links are not displayed |
There is a branch that was started for rails 3.x It works fine on rails 3.0.x but haven't tried on 3.1. The branch is rails3 |
RJS has been extracted from 3.1 and placed in the prototype-rails gem. |
Here is how I integrated with my 3.1 rc5. your controller # POST
def rate
@location = Location.find(params[:id])
respond_to do |format|
if @location.rate(params[:stars], current_user, params[:dimension])
format.js { render :partial => "rating" }
else
format.js { render :partial => "rating" }
end
end
end _rating.html.erb<%= ratings_for @location, current_user %> app.jsI'm using $('a').live('ajax:complete', function(xhr, status) {
$(".ajaxful-rating-wrapper").replaceWith(status.responseText)
}); ajaxful_ratings.cssNot sure if this is by design or not but I had to set a width on the wrapper so only 5 stars were displayed. It showed all by default. #sidebar .ajaxful-rating-wrapper {width:125px;} show.html.erb <%= render "rating" %> |
Also with 3.1 you don't need to copy the assets into the public directory. Ryan did a nice demo explaining how to use the different asset directories. I could probably find the time to make a 3.1 branch if you want. |
The only rjs helper that I'm "using" is in the README.md file for demonstration only of how you'd like to use it. But that's not dependent of the gem, you can use any js method to update the wrapper. The gem itself doesn't use any rjs helper. |
This was incredibly useful for me. Can we leave this open or move this to the documentation? |
@josephers +1 |
Thanks a lot jspooner for putting up that code snipet. For others, If you are allowing users to rate on multiple dimension, then you must replace the correct wrapper. I did something like this:
And my _rating.html.erb looks like this:
And I pass dimension from merchant controller:
Hope that helps someone. |
@jimishjoban That certainly helps me! |
this question might be silly. when you include gem 'ajaxful-rating', how do you specify it to use Rails3 branch? I guess I can go to the gem folder and do git checkout. But if i am deploying on heroku how do i specify it in GemFile? Thanks. |
You just need to add the beta version, like: gem 'ajaxful_rating', "~> 3.0.0.beta8" edgar.js On Sat, Feb 4, 2012 at 11:01 AM, Ben Zhang <
|
I too have had issues after upgrading to Rails 3.1, even after reverting back to prototype. The rating stars render OK on the page, but the controller stops for a no-method error upon calling the ratings_for helper (the rates table is updated correctly in the previous statement). Note that the helper executes correctly when called by the .erb view. |
Have you tried a solution from wiki? It worked for me recently. |
I used that solution and it works great. Next time I will remember to check the wiki :-). Thank you katafrakt! |
I tried jspooner and wiki solutions but it not enough. |
I'm using ajaxful_rating with rails 3.1.3 and Devise (working now thanks to the wiki docs), haven't had any CSRF problems. I assume when you "view source" on your page, you see the CSRF meta tag (like this):
I'm planning to upgrade to Rails 3.2.3 this week and see if anything breaks. |
Yes, I have CSRF meta tag but I don't have token in request's parameters (It should be send by default but it doesn't) |
Anyone tried to use this with rails 3.1? I think the ajax helpers have been removed so none of the javascript works. I'd be happy to fork and update if your not working on that.
The text was updated successfully, but these errors were encountered: