複数のパラメータの平均を行うようにトリミングします。 1つのユニークなパラメータについては、すべて完全に動作しますが、複数のパラメータを平均することはできません。手伝って頂けますか ?複数のparamsのために複数のパラメータのグローバル平均
@ratingservice = Comment.where(:camping_id => params[:id]).average(:service).to_i
@ratingcommunication = Comment.where(:camping_id => params[:id]).average(:communication).to_i
@ratingqualiteprix = Comment.where(:camping_id => params[:id]).average(:qualiteprix).to_i
@ratinganimation = Comment.where(:camping_id => params[:id]).average(:animation).to_i
@ratingproprete = Comment.where(:camping_id => params[:id]).average(:proprete).to_i
@ratingsituation = Comment.where(:camping_id => params[:id]).average(:situation).to_i
このコマンドdoesntの仕事:このメソッドは確かに乾燥していないちなみに初期化されていない一定の
@ratingall = Commment.where(:camping_id => params[:id]).average(:service, :communication, :qualiteprix, :animation, :proprete, :situation).to_i
....
個人的に、まだ試していません。グループ(:サービス、...) '戻り値を確認してからsum/avgなどを取得してください...私に教えてください! – 7urkm3n