Commit da0b1b3f698022eddb69d828b9a8dabedb5b1122
1 parent
e4346d57
Exists in
ratings_minor_fixes
and in
3 other branches
Adds models error message to session notice
Signed-off-by: Thiago Ribeiro <thiagitosouza@gmail.com>
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 | 47 | create_rating_comment(rating) |
48 | 48 | session[:notice] = _("%s successfully rated!") % profile.name |
49 | 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 | 51 | end |
52 | 52 | |
53 | 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 | 46 | test "do not create community_rating without a rate value" do |
47 | 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 | 50 | end |
51 | 51 | |
52 | 52 | test "do not create two ratings on Community when vote once config is true" do | ... | ... |