Commit 2fb870259729af266f41655b43aef380390727e0
1 parent
64520681
Exists in
stable-spb-1.5
Adds models error message to session notice
Signed-off-by: Thiago Ribeiro <thiagitosouza@gmail.com> (cherry picked from commit da0b1b3f698022eddb69d828b9a8dabedb5b1122)
Showing
2 changed files
with
2 additions
and
2 deletions
Show diff stats
plugins/organization_ratings/controllers/organization_ratings_plugin_profile_controller.rb
@@ -47,7 +47,7 @@ class OrganizationRatingsPluginProfileController < ProfileController | @@ -47,7 +47,7 @@ class OrganizationRatingsPluginProfileController < ProfileController | ||
47 | create_rating_comment(rating) | 47 | create_rating_comment(rating) |
48 | session[:notice] = _("%s successfully rated!") % profile.name | 48 | session[:notice] = _("%s successfully rated!") % profile.name |
49 | else | 49 | else |
50 | - session[:notice] = _("Sorry, there were problems rating this profile.") | 50 | + session[:notice] = rating.errors.messages.map{|field, message|"#{_(field.to_s)}: #{_(message.first)}"}.to_s |
51 | end | 51 | end |
52 | 52 | ||
53 | redirect_to profile.url | 53 | redirect_to profile.url |
plugins/organization_ratings/test/functional/organization_ratings_plugin_profile_controller_test.rb
@@ -46,7 +46,7 @@ class OrganizationRatingsPluginProfileControllerTest < ActionController::TestCas | @@ -46,7 +46,7 @@ class OrganizationRatingsPluginProfileControllerTest < ActionController::TestCas | ||
46 | test "do not create community_rating without a rate value" do | 46 | test "do not create community_rating without a rate value" do |
47 | post :new_rating, profile: @community.identifier, :comments => {:body => ""}, :organization_rating_value => nil | 47 | post :new_rating, profile: @community.identifier, :comments => {:body => ""}, :organization_rating_value => nil |
48 | 48 | ||
49 | - assert_equal "Sorry, there were problems rating this profile.", session[:notice] | 49 | + assert_match "value: can't be blank", session[:notice] |
50 | end | 50 | end |
51 | 51 | ||
52 | test "do not create two ratings on Community when vote once config is true" do | 52 | test "do not create two ratings on Community when vote once config is true" do |