app/controllers/posts_controller.rb
# We don't want anybody anonymous to create new Posts.
# So in all child controllers this filter will work fine. 
We don't want anybody anonymous to create new Posts.
So in all child controllers this filter will work fine.
We don ' t want anybody anonymous to create new Posts . So in all child controllers this filter will work fine .
def decrease_rating
    unauthorized! if cannot? :change_rating_for, Post
    Post.decrement_counter(:rating, params[:post_id] )
    @post = Post.find(params[:post_id])
    respond_to do |format|
      format.js
    end
  end
def decrease_rating unauthorized! if cannot? :change_rating_for , Post Post . decrement_counter ( :rating , params [ :post_id ] ) @post = Post . find ( params [ :post_id ] ) respond_to do | format | format . js end end
We don't want anybody anonymous to create new Posts.
We don ' t want anybody anonymous to create new Posts .