Commit 297b3b7204a8d29cb6939a3c8ed4eb2ad5a925a2
1 parent
b0874b74
Exists in
master
and in
23 other branches
Fixing AI2897 problems:
-Changed update_attribute to setting the attribute then 'save!' -Removed some whitespaces -The file controller/themes_controller.rb is needed because it is inherited by controller/my_profile/profile_themes_controller.rb and controller/admin/environment_themes_controller.rb, it is a generalization. Before this functionality was created, there was only one file called controller/my_profile/themes_controller.rb. (ActionItem2897) Signed-off-by: Alex de Souza <campelo.al1@gmail.com> Signed-off-by: Gustavo Jaruga <darksshades@hotmail.com>
Showing
4 changed files
with
12 additions
and
6 deletions
Show diff stats
app/controllers/themes_controller.rb
app/models/environment.rb
| ... | ... | @@ -679,11 +679,13 @@ class Environment < ActiveRecord::Base |
| 679 | 679 | end |
| 680 | 680 | |
| 681 | 681 | def update_theme(theme) |
| 682 | - self.update_attribute(:theme, theme) | |
| 682 | + self.theme = theme | |
| 683 | + self.save! | |
| 683 | 684 | end |
| 684 | 685 | |
| 685 | 686 | def update_layout_template(template) |
| 686 | - self.update_attribute(:layout_template, template) | |
| 687 | + self.layout_template = template | |
| 688 | + self.save! | |
| 687 | 689 | end |
| 688 | 690 | |
| 689 | 691 | before_create do |env| | ... | ... |
test/functional/environment_themes_controller_test.rb
| ... | ... | @@ -96,7 +96,8 @@ class EnvironmentThemesControllerTest < ActionController::TestCase |
| 96 | 96 | |
| 97 | 97 | should 'display links to set template' do |
| 98 | 98 | env = Environment.default |
| 99 | - env.update_attributes!(:layout_template => 'rightbar') | |
| 99 | + env.layout_template = 'rightbar' | |
| 100 | + env.save! | |
| 100 | 101 | t1 = LayoutTemplate.find('default') |
| 101 | 102 | t2 = LayoutTemplate.find('leftbar') |
| 102 | 103 | LayoutTemplate.expects(:all).returns([t1, t2]) |
| ... | ... | @@ -109,6 +110,7 @@ class EnvironmentThemesControllerTest < ActionController::TestCase |
| 109 | 110 | should 'highlight current template' do |
| 110 | 111 | env = Environment.default |
| 111 | 112 | env.update_attributes!(:layout_template => 'default') |
| 113 | + env.layout_template = 'default' | |
| 112 | 114 | |
| 113 | 115 | t1 = LayoutTemplate.find('default') |
| 114 | 116 | t2 = LayoutTemplate.find('leftbar') | ... | ... |
test/functional/profile_themes_controller_test.rb
| ... | ... | @@ -254,7 +254,8 @@ class ProfileThemesControllerTest < ActionController::TestCase |
| 254 | 254 | end |
| 255 | 255 | |
| 256 | 256 | should 'display links to set template' do |
| 257 | - profile.update_attributes!(:layout_template => 'rightbar') | |
| 257 | + profile.layout_template = 'rightbar' | |
| 258 | + profile.save! | |
| 258 | 259 | t1 = LayoutTemplate.find('default') |
| 259 | 260 | t2 = LayoutTemplate.find('leftbar') |
| 260 | 261 | LayoutTemplate.expects(:all).returns([t1, t2]) |
| ... | ... | @@ -265,7 +266,8 @@ class ProfileThemesControllerTest < ActionController::TestCase |
| 265 | 266 | end |
| 266 | 267 | |
| 267 | 268 | should 'highlight current template' do |
| 268 | - profile.update_attributes!(:layout_template => 'default') | |
| 269 | + profile.layout_template = 'default' | |
| 270 | + profile.save! | |
| 269 | 271 | |
| 270 | 272 | t1 = LayoutTemplate.find('default') |
| 271 | 273 | t2 = LayoutTemplate.find('leftbar') | ... | ... |