Commit 69733db27c41c725aa3a95666ab30b25f2ffad0a

Authored by Fabio Teixeira
1 parent f82cb9bd
Exists in temp_ratings

Enable community_rating to save hotspot extra fields

Signed-off-by: DylanGuedes <djmgguedes@gmail.com>
Signed-off-by: Fabio Teixeira <fabio1079@gmail.com>
plugins/communities_ratings/controllers/communities_ratings_plugin_profile_controller.rb
@@ -5,24 +5,22 @@ class CommunitiesRatingsPluginProfileController &lt; ProfileController @@ -5,24 +5,22 @@ class CommunitiesRatingsPluginProfileController &lt; ProfileController
5 @rating_available = can_rate_now? 5 @rating_available = can_rate_now?
6 return unless @rating_available 6 return unless @rating_available
7 7
8 - # @plugins = plugins  
9 @default_rate = environment.communities_ratings_default_rating 8 @default_rate = environment.communities_ratings_default_rating
10 @min_rate = Environment.communities_ratings_min_rating 9 @min_rate = Environment.communities_ratings_min_rating
11 10
12 if request.post? 11 if request.post?
13 12
14 - unless params[:comments].blank? and params[:comments][:body].empty? 13 + unless params[:comments].blank? and params[:comments][:body].empty?
15 comment = Comment.new(params[:comments]) 14 comment = Comment.new(params[:comments])
16 comment.author = current_user.person 15 comment.author = current_user.person
17 comment.community = profile 16 comment.community = profile
18 comment.save 17 comment.save
19 18
20 - community_rating = CommunityRating.new(  
21 - :person => current_user.person,  
22 - :community => profile,  
23 - :value => params[:community_rating_value]  
24 - ) 19 + community_rating = CommunityRating.new(params[:community_rating])
  20 + community_rating.person = current_user.person
  21 + community_rating.community = profile
25 community_rating.comment = comment 22 community_rating.comment = comment
  23 + community_rating.value = params[:community_rating_value]
26 end 24 end
27 25
28 if community_rating.save 26 if community_rating.save