diff --git a/app/controllers/my_profile/cms_controller.rb b/app/controllers/my_profile/cms_controller.rb index 787e9df..d0f08d3 100644 --- a/app/controllers/my_profile/cms_controller.rb +++ b/app/controllers/my_profile/cms_controller.rb @@ -149,7 +149,7 @@ class CmsController < MyProfileController def set_home_page @article = profile.articles.find(params[:id]) profile.home_page = @article - profile.save! + profile.save(false) flash[:notice] = _('"%s" configured as home page.') % @article.name redirect_to :action => 'view', :id => @article.id end diff --git a/test/functional/cms_controller_test.rb b/test/functional/cms_controller_test.rb index b486195..c48bbe3 100644 --- a/test/functional/cms_controller_test.rb +++ b/test/functional/cms_controller_test.rb @@ -121,6 +121,25 @@ class CmsControllerTest < Test::Unit::TestCase assert_equal a, profile.home_page end + should 'be able to set home page even when profile description is invalid' do + a = profile.articles.build(:name => 'my new home page') + a.save! + + profile.description = 'a' * 600 + profile.save(false) + + assert !profile.valid? + assert_not_equal a, profile.home_page + + post :set_home_page, :profile => profile.identifier, :id => a.id + + assert_redirected_to :action => 'view', :id => a.id + + profile = Profile.find(@profile.id) + assert_equal a, profile.home_page + end + + should 'set last_changed_by when creating article' do login_as(profile.identifier) -- libgit2 0.21.2