Commit d486c3ff8d7a02944552a529df632ae6ff632319

Authored by Braulio Bhavamitra
1 parent b71858da

rails4: replace update_attributes with the new update

Showing 60 changed files with 98 additions and 98 deletions   Show diff stats
app/controllers/admin/admin_panel_controller.rb
@@ -12,7 +12,7 @@ class AdminPanelController < AdminController @@ -12,7 +12,7 @@ class AdminPanelController < AdminController
12 if params[:environment][:languages] 12 if params[:environment][:languages]
13 params[:environment][:languages] = params[:environment][:languages].map {|lang, value| lang if value=='true'}.compact 13 params[:environment][:languages] = params[:environment][:languages].map {|lang, value| lang if value=='true'}.compact
14 end 14 end
15 - if @environment.update_attributes(params[:environment]) 15 + if @environment.update(params[:environment])
16 session[:notice] = _('Environment settings updated') 16 session[:notice] = _('Environment settings updated')
17 redirect_to :action => 'index' 17 redirect_to :action => 'index'
18 end 18 end
@@ -65,7 +65,7 @@ class AdminPanelController < AdminController @@ -65,7 +65,7 @@ class AdminPanelController < AdminController
65 65
66 def set_portal_news_amount 66 def set_portal_news_amount
67 if request.post? 67 if request.post?
68 - if @environment.update_attributes(params[:environment]) 68 + if @environment.update(params[:environment])
69 session[:notice] = _('Saved the number of news on folders') 69 session[:notice] = _('Saved the number of news on folders')
70 redirect_to :action => 'index' 70 redirect_to :action => 'index'
71 end 71 end
app/controllers/admin/categories_controller.rb
@@ -43,7 +43,7 @@ class CategoriesController < AdminController @@ -43,7 +43,7 @@ class CategoriesController < AdminController
43 begin 43 begin
44 @category = environment.categories.find(params[:id]) 44 @category = environment.categories.find(params[:id])
45 if request.post? 45 if request.post?
46 - @category.update_attributes!(params[:category]) 46 + @category.update!(params[:category])
47 @saved = true 47 @saved = true
48 session[:notice] = _("Category %s saved." % @category.name) 48 session[:notice] = _("Category %s saved." % @category.name)
49 redirect_to :action => 'index' 49 redirect_to :action => 'index'
app/controllers/admin/features_controller.rb
@@ -7,7 +7,7 @@ class FeaturesController < AdminController @@ -7,7 +7,7 @@ class FeaturesController < AdminController
7 7
8 post_only :update 8 post_only :update
9 def update 9 def update
10 - if @environment.update_attributes(params[:environment]) 10 + if @environment.update(params[:environment])
11 session[:notice] = _('Features updated successfully.') 11 session[:notice] = _('Features updated successfully.')
12 redirect_to :action => 'index' 12 redirect_to :action => 'index'
13 else 13 else
app/controllers/admin/licenses_controller.rb
@@ -23,7 +23,7 @@ class LicensesController < AdminController @@ -23,7 +23,7 @@ class LicensesController < AdminController
23 @license = environment.licenses.find(params[:license_id]) 23 @license = environment.licenses.find(params[:license_id])
24 if request.post? 24 if request.post?
25 begin 25 begin
26 - @license.update_attributes!(params[:license]) 26 + @license.update!(params[:license])
27 session[:notice] = _('License updated') 27 session[:notice] = _('License updated')
28 redirect_to :action => 'index' 28 redirect_to :action => 'index'
29 rescue 29 rescue
app/controllers/admin/plugins_controller.rb
@@ -8,7 +8,7 @@ class PluginsController < AdminController @@ -8,7 +8,7 @@ class PluginsController < AdminController
8 post_only :update 8 post_only :update
9 def update 9 def update
10 params[:environment][:enabled_plugins].delete('') 10 params[:environment][:enabled_plugins].delete('')
11 - if @environment.update_attributes(params[:environment]) 11 + if @environment.update(params[:environment])
12 session[:notice] = _('Plugins updated successfully.') 12 session[:notice] = _('Plugins updated successfully.')
13 else 13 else
14 session[:error] = _('Plugins were not updated successfully.') 14 session[:error] = _('Plugins were not updated successfully.')
app/controllers/admin/role_controller.rb
@@ -29,7 +29,7 @@ class RoleController < AdminController @@ -29,7 +29,7 @@ class RoleController < AdminController
29 29
30 def update 30 def update
31 @role = environment.roles.find(params[:id]) 31 @role = environment.roles.find(params[:id])
32 - if @role.update_attributes(params[:role]) 32 + if @role.update(params[:role])
33 redirect_to :action => 'show', :id => @role 33 redirect_to :action => 'show', :id => @role
34 else 34 else
35 session[:notice] = _('Failed to edit role') 35 session[:notice] = _('Failed to edit role')
app/controllers/box_organizer_controller.rb
@@ -98,7 +98,7 @@ class BoxOrganizerController < ApplicationController @@ -98,7 +98,7 @@ class BoxOrganizerController < ApplicationController
98 98
99 def save 99 def save
100 @block = boxes_holder.blocks.find(params[:id]) 100 @block = boxes_holder.blocks.find(params[:id])
101 - @block.update_attributes(params[:block]) 101 + @block.update(params[:block])
102 redirect_to :action => 'index' 102 redirect_to :action => 'index'
103 end 103 end
104 104
app/controllers/my_profile/cms_controller.rb
@@ -93,7 +93,7 @@ class CmsController < MyProfileController @@ -93,7 +93,7 @@ class CmsController < MyProfileController
93 @article.image.save! 93 @article.image.save!
94 end 94 end
95 @article.last_changed_by = user 95 @article.last_changed_by = user
96 - if @article.update_attributes(params[:article]) 96 + if @article.update(params[:article])
97 if !continue 97 if !continue
98 if @article.content_type.nil? || @article.image? 98 if @article.content_type.nil? || @article.image?
99 success_redirect 99 success_redirect
app/controllers/my_profile/enterprise_validation_controller.rb
@@ -54,7 +54,7 @@ class EnterpriseValidationController < MyProfileController @@ -54,7 +54,7 @@ class EnterpriseValidationController < MyProfileController
54 def edit_validation_info 54 def edit_validation_info
55 @info = profile.validation_info 55 @info = profile.validation_info
56 if request.post? 56 if request.post?
57 - if @info.update_attributes(params[:info]) 57 + if @info.update(params[:info])
58 redirect_to :action => 'index' 58 redirect_to :action => 'index'
59 end 59 end
60 end 60 end
app/controllers/my_profile/manage_products_controller.rb
@@ -69,7 +69,7 @@ class ManageProductsController < ApplicationController @@ -69,7 +69,7 @@ class ManageProductsController < ApplicationController
69 field = params[:field] 69 field = params[:field]
70 if request.post? 70 if request.post?
71 begin 71 begin
72 - @product.update_attributes!(params[:product]) 72 + @product.update!(params[:product])
73 render :partial => "display_#{field}", :locals => {:product => @product} 73 render :partial => "display_#{field}", :locals => {:product => @product}
74 rescue Exception => e 74 rescue Exception => e
75 render :partial => "edit_#{field}", :locals => {:product => @product, :errors => true} 75 render :partial => "edit_#{field}", :locals => {:product => @product, :errors => true}
@@ -86,7 +86,7 @@ class ManageProductsController < ApplicationController @@ -86,7 +86,7 @@ class ManageProductsController < ApplicationController
86 @edit = true 86 @edit = true
87 @level = @category.level 87 @level = @category.level
88 if request.post? 88 if request.post?
89 - if @product.update_attributes({:product_category_id => params[:selected_category_id]}, :without_protection => true) 89 + if @product.update({:product_category_id => params[:selected_category_id]}, :without_protection => true)
90 render :partial => 'shared/redirect_via_javascript', 90 render :partial => 'shared/redirect_via_javascript',
91 :locals => { :url => url_for(:controller => 'manage_products', :action => 'show', :id => @product) } 91 :locals => { :url => url_for(:controller => 'manage_products', :action => 'show', :id => @product) }
92 else 92 else
@@ -115,7 +115,7 @@ class ManageProductsController < ApplicationController @@ -115,7 +115,7 @@ class ManageProductsController < ApplicationController
115 @categories = ProductCategory.top_level_for(environment) 115 @categories = ProductCategory.top_level_for(environment)
116 @level = 0 116 @level = 0
117 if request.post? 117 if request.post?
118 - if @input.update_attributes(:product_category_id => params[:selected_category_id]) 118 + if @input.update(:product_category_id => params[:selected_category_id])
119 @inputs = @product.inputs 119 @inputs = @product.inputs
120 render :partial => 'display_inputs' 120 render :partial => 'display_inputs'
121 else 121 else
@@ -172,7 +172,7 @@ class ManageProductsController < ApplicationController @@ -172,7 +172,7 @@ class ManageProductsController < ApplicationController
172 @input = @profile.inputs.find_by_id(params[:id]) 172 @input = @profile.inputs.find_by_id(params[:id])
173 if @input 173 if @input
174 if request.post? 174 if request.post?
175 - if @input.update_attributes(params[:input]) 175 + if @input.update(params[:input])
176 render :partial => 'display_input', :locals => {:input => @input} 176 render :partial => 'display_input', :locals => {:input => @input}
177 else 177 else
178 render :partial => 'edit_input' 178 render :partial => 'edit_input'
app/controllers/my_profile/maps_controller.rb
@@ -15,7 +15,7 @@ class MapsController < MyProfileController @@ -15,7 +15,7 @@ class MapsController < MyProfileController
15 end 15 end
16 16
17 Profile.transaction do 17 Profile.transaction do
18 - if profile.update_attributes!(params[:profile_data]) 18 + if profile.update!(params[:profile_data])
19 BlockSweeper.expire_blocks profile.blocks.select{ |b| b.class == LocationBlock } 19 BlockSweeper.expire_blocks profile.blocks.select{ |b| b.class == LocationBlock }
20 session[:notice] = _('Address was updated successfully!') 20 session[:notice] = _('Address was updated successfully!')
21 redirect_to :action => 'edit_location' 21 redirect_to :action => 'edit_location'
app/controllers/my_profile/profile_editor_controller.rb
@@ -24,7 +24,7 @@ class ProfileEditorController < MyProfileController @@ -24,7 +24,7 @@ class ProfileEditorController < MyProfileController
24 Image.transaction do 24 Image.transaction do
25 begin 25 begin
26 @plugins.dispatch(:profile_editor_transaction_extras) 26 @plugins.dispatch(:profile_editor_transaction_extras)
27 - @profile_data.update_attributes!(params[:profile_data]) 27 + @profile_data.update!(params[:profile_data])
28 redirect_to :action => 'index', :profile => profile.identifier 28 redirect_to :action => 'index', :profile => profile.identifier
29 rescue Exception => ex 29 rescue Exception => ex
30 profile.identifier = params[:profile] if profile.identifier.blank? 30 profile.identifier = params[:profile] if profile.identifier.blank?
@@ -94,7 +94,7 @@ class ProfileEditorController < MyProfileController @@ -94,7 +94,7 @@ class ProfileEditorController < MyProfileController
94 @welcome_page = profile.welcome_page || TinyMceArticle.new(:name => 'Welcome Page', :profile => profile, :published => false) 94 @welcome_page = profile.welcome_page || TinyMceArticle.new(:name => 'Welcome Page', :profile => profile, :published => false)
95 if request.post? 95 if request.post?
96 begin 96 begin
97 - @welcome_page.update_attributes!(params[:welcome_page]) 97 + @welcome_page.update!(params[:welcome_page])
98 profile.welcome_page = @welcome_page 98 profile.welcome_page = @welcome_page
99 profile.save! 99 profile.save!
100 session[:notice] = _('Welcome page saved successfully.') 100 session[:notice] = _('Welcome page saved successfully.')
app/controllers/my_profile/profile_roles_controller.rb
@@ -58,7 +58,7 @@ class ProfileRolesController < MyProfileController @@ -58,7 +58,7 @@ class ProfileRolesController < MyProfileController
58 58
59 def update 59 def update
60 @role = environment.roles.find(params[:id]) 60 @role = environment.roles.find(params[:id])
61 - if @role.update_attributes(params[:role]) 61 + if @role.update(params[:role])
62 redirect_to :action => 'show', :id => @role 62 redirect_to :action => 'show', :id => @role
63 else 63 else
64 session[:notice] = _('Failed to edit role') 64 session[:notice] = _('Failed to edit role')
app/controllers/my_profile/tasks_controller.rb
@@ -48,7 +48,7 @@ class TasksController < MyProfileController @@ -48,7 +48,7 @@ class TasksController < MyProfileController
48 if request.post? && VALID_DECISIONS.include?(decision) && id && decision != 'skip' 48 if request.post? && VALID_DECISIONS.include?(decision) && id && decision != 'skip'
49 task = profile.find_in_all_tasks(id) 49 task = profile.find_in_all_tasks(id)
50 begin 50 begin
51 - task.update_attributes(value[:task]) 51 + task.update(value[:task])
52 task.send(decision, current_person) 52 task.send(decision, current_person)
53 rescue Exception => ex 53 rescue Exception => ex
54 message = "#{task.title} (#{task.requestor ? task.requestor.name : task.author_name})" 54 message = "#{task.title} (#{task.requestor ? task.requestor.name : task.author_name})"
app/controllers/public/account_controller.rb
@@ -119,7 +119,7 @@ class AccountController < ApplicationController @@ -119,7 +119,7 @@ class AccountController < ApplicationController
119 @user.person.affiliate(@user.person, [owner_role]) if owner_role 119 @user.person.affiliate(@user.person, [owner_role]) if owner_role
120 invitation = Task.from_code(@invitation_code).first 120 invitation = Task.from_code(@invitation_code).first
121 if invitation 121 if invitation
122 - invitation.update_attributes! friend: @user.person 122 + invitation.update! friend: @user.person
123 invitation.finish 123 invitation.finish
124 end 124 end
125 125
@@ -218,7 +218,7 @@ class AccountController < ApplicationController @@ -218,7 +218,7 @@ class AccountController < ApplicationController
218 218
219 if request.post? 219 if request.post?
220 begin 220 begin
221 - @change_password.update_attributes!(params[:change_password]) 221 + @change_password.update!(params[:change_password])
222 @change_password.finish 222 @change_password.finish
223 render :action => 'new_password_ok' 223 render :action => 'new_password_ok'
224 rescue ActiveRecord::RecordInvalid => e 224 rescue ActiveRecord::RecordInvalid => e
@@ -487,7 +487,7 @@ class AccountController < ApplicationController @@ -487,7 +487,7 @@ class AccountController < ApplicationController
487 def check_redirection 487 def check_redirection
488 unless params[:redirection].blank? 488 unless params[:redirection].blank?
489 session[:return_to] = @user.return_to 489 session[:return_to] = @user.return_to
490 - @user.update_attributes(:return_to => nil) 490 + @user.update(:return_to => nil)
491 end 491 end
492 end 492 end
493 493
app/controllers/public/chat_controller.rb
@@ -67,7 +67,7 @@ class ChatController < PublicController @@ -67,7 +67,7 @@ class ChatController < PublicController
67 67
68 def update_presence_status 68 def update_presence_status
69 if request.xhr? 69 if request.xhr?
70 - current_user.update_attributes({:chat_status_at => DateTime.now}.merge(params[:status] || {})) 70 + current_user.update({:chat_status_at => DateTime.now}.merge(params[:status] || {}))
71 end 71 end
72 render :nothing => true 72 render :nothing => true
73 end 73 end
app/controllers/public/comment_controller.rb
@@ -78,7 +78,7 @@ class CommentController < ApplicationController @@ -78,7 +78,7 @@ class CommentController < ApplicationController
78 respond_to do |format| 78 respond_to do |format|
79 format.js do 79 format.js do
80 comment_to_render = @comment.comment_root 80 comment_to_render = @comment.comment_root
81 - render :json => { 81 + render :json => {
82 :render_target => comment_to_render.anchor, 82 :render_target => comment_to_render.anchor,
83 :html => render_to_string(:partial => 'comment', :locals => {:comment => comment_to_render, :display_link => true}), 83 :html => render_to_string(:partial => 'comment', :locals => {:comment => comment_to_render, :display_link => true}),
84 :msg => _('Comment successfully created.') 84 :msg => _('Comment successfully created.')
@@ -114,7 +114,7 @@ class CommentController < ApplicationController @@ -114,7 +114,7 @@ class CommentController < ApplicationController
114 end 114 end
115 115
116 def update 116 def update
117 - if @comment.update_attributes(params[:comment]) 117 + if @comment.update(params[:comment])
118 @plugins.dispatch(:process_extra_comment_params, [@comment,params]) 118 @plugins.dispatch(:process_extra_comment_params, [@comment,params])
119 119
120 respond_to do |format| 120 respond_to do |format|
app/models/certifier.rb
@@ -20,7 +20,7 @@ class Certifier < ActiveRecord::Base @@ -20,7 +20,7 @@ class Certifier < ActiveRecord::Base
20 validates_presence_of :name 20 validates_presence_of :name
21 21
22 def destroy 22 def destroy
23 - product_qualifiers.each { |pq| pq.update_attributes! :certifier => nil } 23 + product_qualifiers.each { |pq| pq.update! :certifier => nil }
24 super 24 super
25 end 25 end
26 26
app/models/create_community.rb
@@ -30,7 +30,7 @@ class CreateCommunity < Task @@ -30,7 +30,7 @@ class CreateCommunity < Task
30 ! DATA_FIELDS.include?(key.to_s) 30 ! DATA_FIELDS.include?(key.to_s)
31 end 31 end
32 32
33 - community.update_attributes(community_data) 33 + community.update(community_data)
34 community.image = image if image 34 community.image = image if image
35 community.environment = self.environment 35 community.environment = self.environment
36 community.save! 36 community.save!
app/models/profile.rb
@@ -720,7 +720,7 @@ private :generate_url, :url_options @@ -720,7 +720,7 @@ private :generate_url, :url_options
720 num = num + 1 720 num = num + 1
721 new_name = original_article.name + ' ' + num.to_s 721 new_name = original_article.name + ' ' + num.to_s
722 end 722 end
723 - original_article.update_attributes!(:name => new_name) 723 + original_article.update!(:name => new_name)
724 end 724 end
725 article_copy = article.copy(:profile => self, :parent => parent, :advertise => false) 725 article_copy = article.copy(:profile => self, :parent => parent, :advertise => false)
726 if article.profile.home_page == article 726 if article.profile.home_page == article
features/step_definitions/noosfero_steps.rb
@@ -15,12 +15,12 @@ Given /^the following users?$/ do |table| @@ -15,12 +15,12 @@ Given /^the following users?$/ do |table|
15 end 15 end
16 16
17 Given /^"(.+)" is (invisible|visible)$/ do |user, visibility| 17 Given /^"(.+)" is (invisible|visible)$/ do |user, visibility|
18 - User.find_by_login(user).person.update_attributes({:visible => (visibility == 'visible')}, :without_protection => true) 18 + User.find_by_login(user).person.update({:visible => (visibility == 'visible')}, :without_protection => true)
19 end 19 end
20 20
21 Given /^"(.+)" is (online|offline|busy) in chat$/ do |user, status| 21 Given /^"(.+)" is (online|offline|busy) in chat$/ do |user, status|
22 status = {'online' => 'chat', 'offline' => '', 'busy' => 'dnd'}[status] 22 status = {'online' => 'chat', 'offline' => '', 'busy' => 'dnd'}[status]
23 - User.find_by_login(user).update_attributes(:chat_status => status, :chat_status_at => DateTime.now) 23 + User.find_by_login(user).update(:chat_status => status, :chat_status_at => DateTime.now)
24 end 24 end
25 25
26 Given /^the following (community|communities|enterprises?|organizations?)$/ do |kind,table| 26 Given /^the following (community|communities|enterprises?|organizations?)$/ do |kind,table|
@@ -680,7 +680,7 @@ end @@ -680,7 +680,7 @@ end
680 Given /^the article "([^\"]*)" is updated with$/ do |article, table| 680 Given /^the article "([^\"]*)" is updated with$/ do |article, table|
681 a = Article.find_by_name article 681 a = Article.find_by_name article
682 row = table.hashes.first 682 row = table.hashes.first
683 - a.update_attributes(row) 683 + a.update(row)
684 end 684 end
685 685
686 Given /^the cache is turned (on|off)$/ do |state| 686 Given /^the cache is turned (on|off)$/ do |state|
lib/acts_as_having_posts.rb
@@ -28,7 +28,7 @@ module ActsAsHavingPosts @@ -28,7 +28,7 @@ module ActsAsHavingPosts
28 def feed=(attrs) 28 def feed=(attrs)
29 if attrs 29 if attrs
30 if self.feed 30 if self.feed
31 - self.feed.update_attributes(attrs) 31 + self.feed.update(attrs)
32 else 32 else
33 self.feed_attrs = attrs 33 self.feed_attrs = attrs
34 end 34 end
plugins/bsc/controllers/bsc_plugin_myprofile_controller.rb
@@ -140,7 +140,7 @@ class BscPluginMyprofileController < MyProfileController @@ -140,7 +140,7 @@ class BscPluginMyprofileController < MyProfileController
140 session[:notice] = _('Could not edit such contract.') 140 session[:notice] = _('Could not edit such contract.')
141 redirect_to :action => 'manage_contracts' 141 redirect_to :action => 'manage_contracts'
142 end 142 end
143 - if request.post? && @contract.update_attributes(params[:contract]) 143 + if request.post? && @contract.update(params[:contract])
144 144
145 # updating associated enterprises 145 # updating associated enterprises
146 enterprises_ids = params[:enterprises] || '' 146 enterprises_ids = params[:enterprises] || ''
@@ -159,7 +159,7 @@ class BscPluginMyprofileController < MyProfileController @@ -159,7 +159,7 @@ class BscPluginMyprofileController < MyProfileController
159 159
160 to_keep.each do |sale_attrs| 160 to_keep.each do |sale_attrs|
161 sale = @contract.sales.find_by_product_id(sale_attrs[:product_id]) 161 sale = @contract.sales.find_by_product_id(sale_attrs[:product_id])
162 - sale.update_attributes!(sale_attrs) 162 + sale.update!(sale_attrs)
163 sales.delete(sale_attrs) 163 sales.delete(sale_attrs)
164 end 164 end
165 165
plugins/comment_classification/controllers/admin/comment_classification_plugin_labels_controller.rb
@@ -27,7 +27,7 @@ class CommentClassificationPluginLabelsController < AdminController @@ -27,7 +27,7 @@ class CommentClassificationPluginLabelsController < AdminController
27 @colors = CommentClassificationPlugin::Label::COLORS 27 @colors = CommentClassificationPlugin::Label::COLORS
28 if request.post? 28 if request.post?
29 begin 29 begin
30 - @label.update_attributes!(params[:label]) 30 + @label.update!(params[:label])
31 session[:notice] = _('Label updated') 31 session[:notice] = _('Label updated')
32 redirect_to :action => :index 32 redirect_to :action => :index
33 rescue 33 rescue
plugins/comment_classification/controllers/admin/comment_classification_plugin_status_controller.rb
@@ -25,7 +25,7 @@ class CommentClassificationPluginStatusController < AdminController @@ -25,7 +25,7 @@ class CommentClassificationPluginStatusController < AdminController
25 @status = CommentClassificationPlugin::Status.find(params[:id]) 25 @status = CommentClassificationPlugin::Status.find(params[:id])
26 if request.post? 26 if request.post?
27 begin 27 begin
28 - @status.update_attributes!(params[:status]) 28 + @status.update!(params[:status])
29 session[:notice] = _('Status updated') 29 session[:notice] = _('Status updated')
30 redirect_to :action => :index 30 redirect_to :action => :index
31 rescue 31 rescue
plugins/comment_classification/controllers/comment_classification_plugin_myprofile_controller.rb
@@ -13,7 +13,7 @@ class CommentClassificationPluginMyprofileController < MyProfileController @@ -13,7 +13,7 @@ class CommentClassificationPluginMyprofileController < MyProfileController
13 @statuses = CommentClassificationPlugin::Status.enabled 13 @statuses = CommentClassificationPlugin::Status.enabled
14 @status = CommentClassificationPlugin::CommentStatusUser.new(:profile => user, :comment => @comment) 14 @status = CommentClassificationPlugin::CommentStatusUser.new(:profile => user, :comment => @comment)
15 if request.post? && params[:status] 15 if request.post? && params[:status]
16 - @status.update_attributes(params[:status]) 16 + @status.update(params[:status])
17 @status.save 17 @status.save
18 end 18 end
19 end 19 end
plugins/driven_signup/controllers/admin/driven_signup_plugin/admin_controller.rb
@@ -15,7 +15,7 @@ class DrivenSignupPlugin::AdminController < AdminController @@ -15,7 +15,7 @@ class DrivenSignupPlugin::AdminController < AdminController
15 def edit 15 def edit
16 @auth = environment.driven_signup_auths.where(id: params[:id]).first 16 @auth = environment.driven_signup_auths.where(id: params[:id]).first
17 @auth ||= environment.driven_signup_auths.build 17 @auth ||= environment.driven_signup_auths.build
18 - @auth.update_attributes params[:auth] 18 + @auth.update params[:auth]
19 end 19 end
20 20
21 def destroy 21 def destroy
plugins/fb_app/controllers/public/fb_app_plugin_page_tab_controller.rb
@@ -68,7 +68,7 @@ class FbAppPluginPageTabController < FbAppPluginController @@ -68,7 +68,7 @@ class FbAppPluginPageTabController < FbAppPluginController
68 if request.put? and @page_id.present? 68 if request.put? and @page_id.present?
69 create_page_tabs if @page_tab.nil? 69 create_page_tabs if @page_tab.nil?
70 70
71 - @page_tab.update_attributes! params[:page_tab] 71 + @page_tab.update! params[:page_tab]
72 72
73 respond_to do |format| 73 respond_to do |format|
74 format.js{ render action: 'admin' } 74 format.js{ render action: 'admin' }
plugins/fb_app/models/fb_app_plugin/page_tab.rb
@@ -27,7 +27,7 @@ class FbAppPlugin::PageTab < ActiveRecord::Base @@ -27,7 +27,7 @@ class FbAppPlugin::PageTab < ActiveRecord::Base
27 page_ids.map do |page_id| 27 page_ids.map do |page_id|
28 page_tab = FbAppPlugin::PageTab.where(page_id: page_id).first 28 page_tab = FbAppPlugin::PageTab.where(page_id: page_id).first
29 page_tab ||= FbAppPlugin::PageTab.new page_id: page_id 29 page_tab ||= FbAppPlugin::PageTab.new page_id: page_id
30 - page_tab.update_attributes! attrs 30 + page_tab.update! attrs
31 page_tab 31 page_tab
32 end 32 end
33 end 33 end
plugins/lattes_curriculum/lib/lattes_curriculum_plugin.rb
@@ -129,7 +129,7 @@ class LattesCurriculumPlugin < Noosfero::Plugin @@ -129,7 +129,7 @@ class LattesCurriculumPlugin < Noosfero::Plugin
129 129
130 def academic_info_transaction 130 def academic_info_transaction
131 AcademicInfo.transaction do 131 AcademicInfo.transaction do
132 - context.profile.academic_info.update_attributes!(context.params[:academic_infos]) 132 + context.profile.academic_info.update!(context.params[:academic_infos])
133 end 133 end
134 end 134 end
135 135
plugins/ldap/controllers/ldap_plugin_admin_controller.rb
@@ -6,7 +6,7 @@ class LdapPluginAdminController < PluginAdminController @@ -6,7 +6,7 @@ class LdapPluginAdminController < PluginAdminController
6 end 6 end
7 7
8 def update 8 def update
9 - if @environment.update_attributes(params[:environment]) 9 + if @environment.update(params[:environment])
10 session[:notice] = _('Ldap configuration updated successfully.') 10 session[:notice] = _('Ldap configuration updated successfully.')
11 else 11 else
12 session[:notice] = _('Ldap configuration could not be saved.') 12 session[:notice] = _('Ldap configuration could not be saved.')
plugins/oauth_client/controllers/oauth_client_plugin_admin_controller.rb
@@ -16,7 +16,7 @@ class OauthClientPluginAdminController < AdminController @@ -16,7 +16,7 @@ class OauthClientPluginAdminController < AdminController
16 def edit 16 def edit
17 @provider = params[:id] ? environment.oauth_providers.find(params[:id]) : environment.oauth_providers.new 17 @provider = params[:id] ? environment.oauth_providers.find(params[:id]) : environment.oauth_providers.new
18 if request.post? 18 if request.post?
19 - if @provider.update_attributes(params['oauth_client_plugin_provider']) 19 + if @provider.update(params['oauth_client_plugin_provider'])
20 session[:notice] = _('Saved!') 20 session[:notice] = _('Saved!')
21 else 21 else
22 session[:notice] = _('Error!') 22 session[:notice] = _('Error!')
plugins/open_graph/controllers/myprofile/open_graph_plugin/myprofile_controller.rb
@@ -17,7 +17,7 @@ class OpenGraphPlugin::MyprofileController < MyProfileController @@ -17,7 +17,7 @@ class OpenGraphPlugin::MyprofileController < MyProfileController
17 end 17 end
18 18
19 def track_config 19 def track_config
20 - profile.update_attributes! params[:profile_data] 20 + profile.update! params[:profile_data]
21 render partial: 'track_form', locals: {context: context, reload: true} 21 render partial: 'track_form', locals: {context: context, reload: true}
22 end 22 end
23 23
plugins/open_graph/test/unit/open_graph_graph/publisher_test.rb
@@ -25,7 +25,7 @@ class OpenGraphPlugin::PublisherTest < ActiveSupport::TestCase @@ -25,7 +25,7 @@ class OpenGraphPlugin::PublisherTest < ActiveSupport::TestCase
25 25
26 @community = @actor.environment.communities.create! name: 'comm', identifier: 'comm', closed: false 26 @community = @actor.environment.communities.create! name: 'comm', identifier: 'comm', closed: false
27 27
28 - @actor.update_attributes!({ 28 + @actor.update!({
29 open_graph_settings: { 29 open_graph_settings: {
30 activity_track_enabled: "true", 30 activity_track_enabled: "true",
31 enterprise_track_enabled: "true", 31 enterprise_track_enabled: "true",
@@ -43,7 +43,7 @@ class OpenGraphPlugin::PublisherTest < ActiveSupport::TestCase @@ -43,7 +43,7 @@ class OpenGraphPlugin::PublisherTest < ActiveSupport::TestCase
43 open_graph_enterprise_profiles_ids: "#{@enterprise.id}", 43 open_graph_enterprise_profiles_ids: "#{@enterprise.id}",
44 open_graph_community_profiles_ids: "#{@community.id}", 44 open_graph_community_profiles_ids: "#{@community.id}",
45 }) 45 })
46 - @other_actor.update_attributes! open_graph_settings: { activity_track_enabled: "true", }, 46 + @other_actor.update! open_graph_settings: { activity_track_enabled: "true", },
47 open_graph_activity_track_configs_attributes: { 0 => { tracker_id: @other_actor.id, object_type: 'friend', }, } 47 open_graph_activity_track_configs_attributes: { 0 => { tracker_id: @other_actor.id, object_type: 'friend', }, }
48 48
49 # active 49 # active
plugins/organization_ratings/controllers/organization_ratings_plugin_admin_controller.rb
@@ -8,7 +8,7 @@ class OrganizationRatingsPluginAdminController < PluginAdminController @@ -8,7 +8,7 @@ class OrganizationRatingsPluginAdminController < PluginAdminController
8 end 8 end
9 9
10 def update 10 def update
11 - if env_organization_ratings_config.update_attributes(params[:organization_ratings_config]) 11 + if env_organization_ratings_config.update(params[:organization_ratings_config])
12 session[:notice] = _('Configuration updated successfully.') 12 session[:notice] = _('Configuration updated successfully.')
13 else 13 else
14 session[:notice] = _('Configuration could not be saved.') 14 session[:notice] = _('Configuration could not be saved.')
@@ -16,4 +16,4 @@ class OrganizationRatingsPluginAdminController < PluginAdminController @@ -16,4 +16,4 @@ class OrganizationRatingsPluginAdminController < PluginAdminController
16 render :action => 'index' 16 render :action => 'index'
17 end 17 end
18 18
19 -end  
20 \ No newline at end of file 19 \ No newline at end of file
  20 +end
plugins/piwik/controllers/piwik_plugin_admin_controller.rb
@@ -4,7 +4,7 @@ class PiwikPluginAdminController < PluginAdminController @@ -4,7 +4,7 @@ class PiwikPluginAdminController < PluginAdminController
4 4
5 def index 5 def index
6 if request.post? 6 if request.post?
7 - if @environment.update_attributes(params[:environment]) 7 + if @environment.update(params[:environment])
8 session[:notice] = _('Piwik plugin settings updated successfully.') 8 session[:notice] = _('Piwik plugin settings updated successfully.')
9 else 9 else
10 session[:notice] = _('Piwik plugin settings could not be saved.') 10 session[:notice] = _('Piwik plugin settings could not be saved.')
plugins/send_email/controllers/send_email_plugin_admin_controller.rb
@@ -3,7 +3,7 @@ class SendEmailPluginAdminController < PluginsController @@ -3,7 +3,7 @@ class SendEmailPluginAdminController < PluginsController
3 def index 3 def index
4 @environment = environment 4 @environment = environment
5 if request.post? 5 if request.post?
6 - if environment.update_attributes(params[:environment]) 6 + if environment.update(params[:environment])
7 session[:notice] = _('Configurations was saved') 7 session[:notice] = _('Configurations was saved')
8 redirect_to :controller => 'plugins' 8 redirect_to :controller => 'plugins'
9 else 9 else
plugins/sniffer/controllers/sniffer_plugin_myprofile_controller.rb
@@ -9,7 +9,7 @@ class SnifferPluginMyprofileController < MyProfileController @@ -9,7 +9,7 @@ class SnifferPluginMyprofileController < MyProfileController
9 def edit 9 def edit
10 if request.post? 10 if request.post?
11 begin 11 begin
12 - @sniffer_profile.update_attributes(params[:sniffer_plugin_profile]) 12 + @sniffer_profile.update(params[:sniffer_plugin_profile])
13 @sniffer_profile.enabled = true 13 @sniffer_profile.enabled = true
14 @sniffer_profile.save! 14 @sniffer_profile.save!
15 session[:notice] = _('Consumer interests updated') 15 session[:notice] = _('Consumer interests updated')
plugins/tolerance_time/controllers/tolerance_time_plugin_myprofile_controller.rb
@@ -5,7 +5,7 @@ class ToleranceTimePluginMyprofileController < MyProfileController @@ -5,7 +5,7 @@ class ToleranceTimePluginMyprofileController < MyProfileController
5 if request.post? 5 if request.post?
6 begin 6 begin
7 convert_params 7 convert_params
8 - @tolerance.update_attributes!(params[:tolerance]) 8 + @tolerance.update!(params[:tolerance])
9 convert_values 9 convert_values
10 session[:notice] = _('Tolerance updated') 10 session[:notice] = _('Tolerance updated')
11 rescue 11 rescue
script/apply-template
@@ -46,7 +46,7 @@ when 'active-enterprise' @@ -46,7 +46,7 @@ when 'active-enterprise'
46 active_enterprises.each do |enterprise| 46 active_enterprises.each do |enterprise|
47 old_home = enterprise.home_page 47 old_home = enterprise.home_page
48 enterprise.apply_template(env.enterprise_template) 48 enterprise.apply_template(env.enterprise_template)
49 - enterprise.home_page.update_attributes!(:body => old_home.body) 49 + enterprise.home_page.update!(:body => old_home.body)
50 enterprise.save! 50 enterprise.save!
51 end 51 end
52 when 'community' 52 when 'community'
test/functional/chat_controller_test.rb
@@ -73,14 +73,14 @@ class ChatControllerTest < ActionController::TestCase @@ -73,14 +73,14 @@ class ChatControllerTest < ActionController::TestCase
73 end 73 end
74 74
75 should 'not update presence status from non-ajax requests' do 75 should 'not update presence status from non-ajax requests' do
76 - @person.user.expects(:update_attributes).never 76 + @person.user.expects(:update).never
77 @controller.stubs(:current_user).returns(@person.user) 77 @controller.stubs(:current_user).returns(@person.user)
78 get :update_presence_status 78 get :update_presence_status
79 assert_template nil 79 assert_template nil
80 end 80 end
81 81
82 should 'update presence status from ajax requests' do 82 should 'update presence status from ajax requests' do
83 - @person.user.expects(:update_attributes).once 83 + @person.user.expects(:update).once
84 @controller.stubs(:current_user).returns(@person.user) 84 @controller.stubs(:current_user).returns(@person.user)
85 @request.stubs(:xhr?).returns(true) 85 @request.stubs(:xhr?).returns(true)
86 get :update_presence_status 86 get :update_presence_status
test/functional/content_viewer_controller_test.rb
@@ -144,7 +144,7 @@ class ContentViewerControllerTest < ActionController::TestCase @@ -144,7 +144,7 @@ class ContentViewerControllerTest < ActionController::TestCase
144 144
145 should 'not display forbidden articles' do 145 should 'not display forbidden articles' do
146 profile.articles.create!(:name => 'test') 146 profile.articles.create!(:name => 'test')
147 - profile.update_attributes!({:public_content => false}, :without_protection => true) 147 + profile.update!({:public_content => false}, :without_protection => true)
148 148
149 Article.any_instance.expects(:display_to?).with(anything).returns(false) 149 Article.any_instance.expects(:display_to?).with(anything).returns(false)
150 get :view_page, :profile => profile.identifier, :page => [ 'test' ] 150 get :view_page, :profile => profile.identifier, :page => [ 'test' ]
@@ -153,7 +153,7 @@ class ContentViewerControllerTest < ActionController::TestCase @@ -153,7 +153,7 @@ class ContentViewerControllerTest < ActionController::TestCase
153 153
154 should 'display allowed articles' do 154 should 'display allowed articles' do
155 profile.articles.create!(:name => 'test') 155 profile.articles.create!(:name => 'test')
156 - profile.update_attributes!({:public_content => false}, :without_protection => true) 156 + profile.update!({:public_content => false}, :without_protection => true)
157 157
158 Article.any_instance.expects(:display_to?).with(anything).returns(true) 158 Article.any_instance.expects(:display_to?).with(anything).returns(true)
159 get :view_page, :profile => profile.identifier, :page => [ 'test' ] 159 get :view_page, :profile => profile.identifier, :page => [ 'test' ]
test/functional/features_controller_test.rb
@@ -66,7 +66,7 @@ class FeaturesControllerTest < ActionController::TestCase @@ -66,7 +66,7 @@ class FeaturesControllerTest < ActionController::TestCase
66 66
67 def test_should_mark_current_organization_approval_method_in_view 67 def test_should_mark_current_organization_approval_method_in_view
68 uses_host 'anhetegua.net' 68 uses_host 'anhetegua.net'
69 - Environment.find(environments(:anhetegua_net).id).update_attributes(:organization_approval_method => :region) 69 + Environment.find(environments(:anhetegua_net).id).update(:organization_approval_method => :region)
70 70
71 post :index 71 post :index
72 72
test/functional/mailconf_controller_test.rb
@@ -60,7 +60,7 @@ class MailconfControllerTest < ActionController::TestCase @@ -60,7 +60,7 @@ class MailconfControllerTest < ActionController::TestCase
60 60
61 should 'display correctly the state false of e-mail enable/disable' do 61 should 'display correctly the state false of e-mail enable/disable' do
62 login_as('ze') 62 login_as('ze')
63 - user.update_attributes!(:enable_email => false) 63 + user.update!(:enable_email => false)
64 get :index, :profile => 'ze' 64 get :index, :profile => 'ze'
65 assert_tag :tag => 'a', :content => 'Enable e-Mail' 65 assert_tag :tag => 'a', :content => 'Enable e-Mail'
66 assert_no_tag :tag => 'a', :content => 'Disable e-Mail', :attributes => { :href => '/myprofile/ze/mailconf/disable' } 66 assert_no_tag :tag => 'a', :content => 'Disable e-Mail', :attributes => { :href => '/myprofile/ze/mailconf/disable' }
test/functional/maps_controller_test.rb
@@ -51,7 +51,7 @@ class MapsControllerTest < ActionController::TestCase @@ -51,7 +51,7 @@ class MapsControllerTest < ActionController::TestCase
51 end 51 end
52 52
53 should 'back when update address fail' do 53 should 'back when update address fail' do
54 - Profile.any_instance.stubs(:update_attributes!).returns(false) 54 + Profile.any_instance.stubs(:update!).returns(false)
55 post :edit_location, :profile => profile.identifier, :profile_data => { 'address' => 'new address' } 55 post :edit_location, :profile => profile.identifier, :profile_data => { 'address' => 'new address' }
56 assert_nil profile.address 56 assert_nil profile.address
57 assert_template 'edit_location' 57 assert_template 'edit_location'
test/functional/profile_editor_controller_test.rb
@@ -196,7 +196,7 @@ class ProfileEditorControllerTest < ActionController::TestCase @@ -196,7 +196,7 @@ class ProfileEditorControllerTest < ActionController::TestCase
196 end 196 end
197 197
198 should 'display properly that the profile is non-public' do 198 should 'display properly that the profile is non-public' do
199 - profile.update_attributes!(:public_profile => false) 199 + profile.update!(:public_profile => false)
200 get :edit, :profile => profile.identifier 200 get :edit, :profile => profile.identifier
201 assert_tag :tag => 'input', :attributes => { :type => 'radio', :checked => 'checked', :name => 'profile_data[public_profile]', :value => 'false' } 201 assert_tag :tag => 'input', :attributes => { :type => 'radio', :checked => 'checked', :name => 'profile_data[public_profile]', :value => 'false' }
202 assert_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'profile_data[public_profile]', :value => 'true' } 202 assert_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'profile_data[public_profile]', :value => 'true' }
@@ -227,7 +227,7 @@ class ProfileEditorControllerTest < ActionController::TestCase @@ -227,7 +227,7 @@ class ProfileEditorControllerTest < ActionController::TestCase
227 227
228 should 'back when update community info fail' do 228 should 'back when update community info fail' do
229 org = fast_create(Community) 229 org = fast_create(Community)
230 - Community.any_instance.expects(:update_attributes!).raises(ActiveRecord::RecordInvalid) 230 + Community.any_instance.expects(:update!).raises(ActiveRecord::RecordInvalid)
231 post :edit, :profile => org.identifier 231 post :edit, :profile => org.identifier
232 232
233 assert_template 'edit' 233 assert_template 'edit'
@@ -237,7 +237,7 @@ class ProfileEditorControllerTest < ActionController::TestCase @@ -237,7 +237,7 @@ class ProfileEditorControllerTest < ActionController::TestCase
237 should 'back when update enterprise info fail' do 237 should 'back when update enterprise info fail' do
238 org = fast_create(Enterprise) 238 org = fast_create(Enterprise)
239 239
240 - Enterprise.any_instance.expects(:update_attributes!).raises(ActiveRecord::RecordInvalid) 240 + Enterprise.any_instance.expects(:update!).raises(ActiveRecord::RecordInvalid)
241 post :edit, :profile => org.identifier 241 post :edit, :profile => org.identifier
242 assert_template 'edit' 242 assert_template 'edit'
243 assert_response :success 243 assert_response :success
@@ -801,7 +801,7 @@ class ProfileEditorControllerTest < ActionController::TestCase @@ -801,7 +801,7 @@ class ProfileEditorControllerTest < ActionController::TestCase
801 end 801 end
802 802
803 should 'show profile nickname on title' do 803 should 'show profile nickname on title' do
804 - profile.update_attributes(:nickname => 'my nick') 804 + profile.update(:nickname => 'my nick')
805 get :index, :profile => profile.identifier 805 get :index, :profile => profile.identifier
806 assert_tag :tag => 'h1', :attributes => { :class => 'block-title'}, :descendant => { 806 assert_tag :tag => 'h1', :attributes => { :class => 'block-title'}, :descendant => {
807 :tag => 'span', :attributes => { :class => 'control-panel-title' }, :content => 'my nick' 807 :tag => 'span', :attributes => { :class => 'control-panel-title' }, :content => 'my nick'
test/functional/tasks_controller_test.rb
@@ -123,7 +123,7 @@ class TasksControllerTest < ActionController::TestCase @@ -123,7 +123,7 @@ class TasksControllerTest < ActionController::TestCase
123 123
124 post :close, :tasks => {t.id => {:decision => 'finish', :task => {}}} 124 post :close, :tasks => {t.id => {:decision => 'finish', :task => {}}}
125 t.reload 125 t.reload
126 - 126 +
127 ok('task should be finished') { t.status == Task::Status::FINISHED } 127 ok('task should be finished') { t.status == Task::Status::FINISHED }
128 128
129 c.reload 129 c.reload
@@ -190,7 +190,7 @@ class TasksControllerTest < ActionController::TestCase @@ -190,7 +190,7 @@ class TasksControllerTest < ActionController::TestCase
190 190
191 should 'create article with reference_article after finish approve article task' do 191 should 'create article with reference_article after finish approve article task' do
192 c = fast_create(Community) 192 c = fast_create(Community)
193 - c.update_attributes(:moderated_articles => false) 193 + c.update(:moderated_articles => false)
194 @controller.stubs(:profile).returns(c) 194 @controller.stubs(:profile).returns(c)
195 c.affiliate(profile, Profile::Roles.all_roles(profile.environment.id)) 195 c.affiliate(profile, Profile::Roles.all_roles(profile.environment.id))
196 article = profile.articles.create!(:name => 'something interesting', :body => 'ruby on rails') 196 article = profile.articles.create!(:name => 'something interesting', :body => 'ruby on rails')
@@ -202,7 +202,7 @@ class TasksControllerTest < ActionController::TestCase @@ -202,7 +202,7 @@ class TasksControllerTest < ActionController::TestCase
202 202
203 should 'create published article in folder after finish approve article task' do 203 should 'create published article in folder after finish approve article task' do
204 c = fast_create(Community) 204 c = fast_create(Community)
205 - c.update_attributes(:moderated_articles => false) 205 + c.update(:moderated_articles => false)
206 @controller.stubs(:profile).returns(c) 206 @controller.stubs(:profile).returns(c)
207 folder = create(Folder, :profile => c, :name => 'test folder') 207 folder = create(Folder, :profile => c, :name => 'test folder')
208 c.affiliate(profile, Profile::Roles.all_roles(profile.environment.id)) 208 c.affiliate(profile, Profile::Roles.all_roles(profile.environment.id))
@@ -215,7 +215,7 @@ class TasksControllerTest < ActionController::TestCase @@ -215,7 +215,7 @@ class TasksControllerTest < ActionController::TestCase
215 215
216 should 'be highlighted if asked when approving a published article' do 216 should 'be highlighted if asked when approving a published article' do
217 c = fast_create(Community) 217 c = fast_create(Community)
218 - c.update_attributes(:moderated_articles => false) 218 + c.update(:moderated_articles => false)
219 @controller.stubs(:profile).returns(c) 219 @controller.stubs(:profile).returns(c)
220 folder = create(Article, :profile => c, :name => 'test folder', :type => 'Folder') 220 folder = create(Article, :profile => c, :name => 'test folder', :type => 'Folder')
221 c.affiliate(profile, Profile::Roles.all_roles(profile.environment.id)) 221 c.affiliate(profile, Profile::Roles.all_roles(profile.environment.id))
@@ -228,7 +228,7 @@ class TasksControllerTest < ActionController::TestCase @@ -228,7 +228,7 @@ class TasksControllerTest < ActionController::TestCase
228 228
229 should 'create article of same class after choosing root folder on approve article task' do 229 should 'create article of same class after choosing root folder on approve article task' do
230 c = fast_create(Community) 230 c = fast_create(Community)
231 - c.update_attributes(:moderated_articles => false) 231 + c.update(:moderated_articles => false)
232 @controller.stubs(:profile).returns(c) 232 @controller.stubs(:profile).returns(c)
233 c.affiliate(profile, Profile::Roles.all_roles(profile.environment.id)) 233 c.affiliate(profile, Profile::Roles.all_roles(profile.environment.id))
234 article = profile.articles.create!(:name => 'something interesting', :body => 'ruby on rails') 234 article = profile.articles.create!(:name => 'something interesting', :body => 'ruby on rails')
test/integration/signup_test.rb
@@ -24,7 +24,7 @@ class SignupTest < ActionDispatch::IntegrationTest @@ -24,7 +24,7 @@ class SignupTest < ActionDispatch::IntegrationTest
24 24
25 def test_should_require_acceptance_of_terms_for_signup 25 def test_should_require_acceptance_of_terms_for_signup
26 env = Environment.default 26 env = Environment.default
27 - env.update_attributes(:terms_of_use => 'You agree to not be annoying.') 27 + env.update(:terms_of_use => 'You agree to not be annoying.')
28 env.min_signup_delay = 0 28 env.min_signup_delay = 0
29 env.save! 29 env.save!
30 30
test/unit/block_test.rb
@@ -136,7 +136,7 @@ class BlockTest < ActiveSupport::TestCase @@ -136,7 +136,7 @@ class BlockTest < ActiveSupport::TestCase
136 user = create_user('testinguser').person 136 user = create_user('testinguser').person
137 box = fast_create(Box, :owner_id => user.id, :owner_type => 'Profile') 137 box = fast_create(Box, :owner_id => user.id, :owner_type => 'Profile')
138 block = create(Block, :display => 'never', :box_id => box.id) 138 block = create(Block, :display => 'never', :box_id => box.id)
139 - assert block.update_attributes!(:display => 'always') 139 + assert block.update!(:display => 'always')
140 block.reload 140 block.reload
141 assert_equal 'always', block.display 141 assert_equal 'always', block.display
142 end 142 end
test/unit/certifier_test.rb
@@ -62,7 +62,7 @@ class CertifierTest < ActiveSupport::TestCase @@ -62,7 +62,7 @@ class CertifierTest < ActiveSupport::TestCase
62 should 'set qualifier as self-certified when destroyed' do 62 should 'set qualifier as self-certified when destroyed' do
63 pq = mock 63 pq = mock
64 Certifier.any_instance.stubs(:product_qualifiers).returns([pq]) 64 Certifier.any_instance.stubs(:product_qualifiers).returns([pq])
65 - pq.expects(:update_attributes!).with(:certifier => nil) 65 + pq.expects(:update!).with(:certifier => nil)
66 cert = fast_create(Certifier) 66 cert = fast_create(Certifier)
67 cert.destroy 67 cert.destroy
68 end 68 end
test/unit/highlights_block_test.rb
@@ -63,7 +63,7 @@ class HighlightsBlockTest < ActiveSupport::TestCase @@ -63,7 +63,7 @@ class HighlightsBlockTest < ActiveSupport::TestCase
63 block = HighlightsBlock.create!(:display => 'never').tap do |b| 63 block = HighlightsBlock.create!(:display => 'never').tap do |b|
64 b.box = box 64 b.box = box
65 end 65 end
66 - assert block.update_attributes!(:display => 'always') 66 + assert block.update!(:display => 'always')
67 block.reload 67 block.reload
68 assert_equal 'always', block.display 68 assert_equal 'always', block.display
69 end 69 end
test/unit/link_list_block_test.rb
@@ -10,7 +10,7 @@ class LinkListBlockTest < ActiveSupport::TestCase @@ -10,7 +10,7 @@ class LinkListBlockTest < ActiveSupport::TestCase
10 l = LinkListBlock.new 10 l = LinkListBlock.new
11 assert_respond_to l, :links 11 assert_respond_to l, :links
12 end 12 end
13 - 13 +
14 should 'default value of links' do 14 should 'default value of links' do
15 l = LinkListBlock.new 15 l = LinkListBlock.new
16 assert_equal [], l.links 16 assert_equal [], l.links
@@ -117,7 +117,7 @@ class LinkListBlockTest < ActiveSupport::TestCase @@ -117,7 +117,7 @@ class LinkListBlockTest < ActiveSupport::TestCase
117 block = LinkListBlock.new(:display => 'never').tap do |b| 117 block = LinkListBlock.new(:display => 'never').tap do |b|
118 b.box = box 118 b.box = box
119 end 119 end
120 - assert block.update_attributes!(:display => 'always') 120 + assert block.update!(:display => 'always')
121 block.reload 121 block.reload
122 assert_equal 'always', block.display 122 assert_equal 'always', block.display
123 end 123 end
test/unit/my_network_block_test.rb
@@ -31,7 +31,7 @@ class MyNetworkBlockTest < ActiveSupport::TestCase @@ -31,7 +31,7 @@ class MyNetworkBlockTest < ActiveSupport::TestCase
31 user = create_user('testinguser').person 31 user = create_user('testinguser').person
32 box = fast_create(Box, :owner_id => user.id) 32 box = fast_create(Box, :owner_id => user.id)
33 block = MyNetworkBlock.create!(:display => 'never', :box => box) 33 block = MyNetworkBlock.create!(:display => 'never', :box => box)
34 - assert block.update_attributes!(:display => 'always') 34 + assert block.update!(:display => 'always')
35 block.reload 35 block.reload
36 assert_equal 'always', block.display 36 assert_equal 'always', block.display
37 end 37 end
test/unit/person_test.rb
@@ -153,7 +153,7 @@ class PersonTest < ActiveSupport::TestCase @@ -153,7 +153,7 @@ class PersonTest < ActiveSupport::TestCase
153 person = create_user('just_another_person').person 153 person = create_user('just_another_person').person
154 env.affiliate(person, role) 154 env.affiliate(person, role)
155 refute person.is_admin?(env) 155 refute person.is_admin?(env)
156 - role.update_attributes(:permissions => ['view_environment_admin_panel']) 156 + role.update(:permissions => ['view_environment_admin_panel'])
157 person = Person.find(person.id) 157 person = Person.find(person.id)
158 assert person.is_admin?(env) 158 assert person.is_admin?(env)
159 end 159 end
@@ -164,7 +164,7 @@ class PersonTest < ActiveSupport::TestCase @@ -164,7 +164,7 @@ class PersonTest < ActiveSupport::TestCase
164 164
165 # role is an admin role 165 # role is an admin role
166 role = create(Role, :name => 'just_another_admin_role') 166 role = create(Role, :name => 'just_another_admin_role')
167 - role.update_attributes(:permissions => ['view_environment_admin_panel']) 167 + role.update(:permissions => ['view_environment_admin_panel'])
168 168
169 # user is admin of env1, but not of env2 169 # user is admin of env1, but not of env2
170 person = create_user('just_another_person').person 170 person = create_user('just_another_person').person
test/unit/recent_documents_block_test.rb
@@ -84,7 +84,7 @@ class RecentDocumentsBlockTest < ActiveSupport::TestCase @@ -84,7 +84,7 @@ class RecentDocumentsBlockTest < ActiveSupport::TestCase
84 end 84 end
85 85
86 should 'be able to update display setting' do 86 should 'be able to update display setting' do
87 - assert @block.update_attributes!(:display => 'always') 87 + assert @block.update!(:display => 'always')
88 @block.reload 88 @block.reload
89 assert_equal 'always', @block.display 89 assert_equal 'always', @block.display
90 end 90 end
test/unit/rss_feed_test.rb
@@ -255,7 +255,7 @@ class RssFeedTest < ActiveSupport::TestCase @@ -255,7 +255,7 @@ class RssFeedTest < ActiveSupport::TestCase
255 should 'include only posts from some language' do 255 should 'include only posts from some language' do
256 profile = create_user('testuser').person 256 profile = create_user('testuser').person
257 blog = create(Blog, :name => 'blog-test', :profile => profile) 257 blog = create(Blog, :name => 'blog-test', :profile => profile)
258 - blog.feed.update_attributes! :language => 'es' 258 + blog.feed.update! :language => 'es'
259 blog.posts << en_post = fast_create(TextArticle, :name => "English", :profile_id => profile.id, :parent_id => blog.id, :published => true, :language => 'en') 259 blog.posts << en_post = fast_create(TextArticle, :name => "English", :profile_id => profile.id, :parent_id => blog.id, :published => true, :language => 'en')
260 blog.posts << es_post = fast_create(TextArticle, :name => "Spanish", :profile_id => profile.id, :parent_id => blog.id, :published => true, :language => 'es') 260 blog.posts << es_post = fast_create(TextArticle, :name => "Spanish", :profile_id => profile.id, :parent_id => blog.id, :published => true, :language => 'es')
261 261
test/unit/user_test.rb
@@ -43,12 +43,12 @@ class UserTest &lt; ActiveSupport::TestCase @@ -43,12 +43,12 @@ class UserTest &lt; ActiveSupport::TestCase
43 end 43 end
44 44
45 def test_should_reset_password 45 def test_should_reset_password
46 - users(:johndoe).update_attributes(:password => 'new password', :password_confirmation => 'new password') 46 + users(:johndoe).update(:password => 'new password', :password_confirmation => 'new password')
47 assert_equal users(:johndoe), User.authenticate('johndoe', 'new password') 47 assert_equal users(:johndoe), User.authenticate('johndoe', 'new password')
48 end 48 end
49 49
50 def test_should_not_rehash_password 50 def test_should_not_rehash_password
51 - users(:johndoe).update_attributes(:login => 'johndoe2') 51 + users(:johndoe).update(:login => 'johndoe2')
52 assert_equal users(:johndoe), User.authenticate('johndoe2', 'test') 52 assert_equal users(:johndoe), User.authenticate('johndoe2', 'test')
53 end 53 end
54 54
vendor/plugins/action_tracker/lib/action_tracker_model.rb
@@ -37,7 +37,7 @@ module ActionTracker @@ -37,7 +37,7 @@ module ActionTracker
37 target_hash = params[:target].nil? ? {} : {:target_type => params[:target].class.base_class.to_s, :target_id => params[:target].id} 37 target_hash = params[:target].nil? ? {} : {:target_type => params[:target].class.base_class.to_s, :target_id => params[:target].id}
38 conditions = { :user_id => u.id, :user_type => u.class.base_class.to_s, :verb => params[:verb].to_s }.merge(target_hash) 38 conditions = { :user_id => u.id, :user_type => u.class.base_class.to_s, :verb => params[:verb].to_s }.merge(target_hash)
39 l = where(conditions).last 39 l = where(conditions).last
40 - ( !l.nil? and Time.now - l.updated_at < ActionTrackerConfig.timeout ) ? l.update_attributes(params.merge({ :updated_at => Time.now })) : l = new(params) 40 + ( !l.nil? and Time.now - l.updated_at < ActionTrackerConfig.timeout ) ? l.update(params.merge({ :updated_at => Time.now })) : l = new(params)
41 l 41 l
42 end 42 end
43 43
@@ -48,7 +48,7 @@ module ActionTracker @@ -48,7 +48,7 @@ module ActionTracker
48 l = where({user_id: u.id, user_type: u.class.base_class.to_s, verb: params[:verb].to_s}.merge target_hash).last 48 l = where({user_id: u.id, user_type: u.class.base_class.to_s, verb: params[:verb].to_s}.merge target_hash).last
49 if !l.nil? and Time.now - l.created_at < ActionTrackerConfig.timeout 49 if !l.nil? and Time.now - l.created_at < ActionTrackerConfig.timeout
50 params[:params].clone.each { |key, value| params[:params][key] = l.params[key].clone.push(value) } 50 params[:params].clone.each { |key, value| params[:params][key] = l.params[key].clone.push(value) }
51 - l.update_attributes params 51 + l.update params
52 else 52 else
53 params[:params].clone.each { |key, value| params[:params][key] = [value] } 53 params[:params].clone.each { |key, value| params[:params][key] = [value] }
54 l = new params 54 l = new params
vendor/plugins/kandadaboggu-vote_fu/examples/voteables_controller.rb
@@ -42,7 +42,7 @@ class VoteablesController &lt; ApplicationController @@ -42,7 +42,7 @@ class VoteablesController &lt; ApplicationController
42 end 42 end
43 43
44 # GET /users/:id/voteables/1/edit 44 # GET /users/:id/voteables/1/edit
45 - def edit 45 + def edit
46 @voteable ||= Voteable.find(params[:id]) 46 @voteable ||= Voteable.find(params[:id])
47 end 47 end
48 48
@@ -51,7 +51,7 @@ class VoteablesController &lt; ApplicationController @@ -51,7 +51,7 @@ class VoteablesController &lt; ApplicationController
51 def create 51 def create
52 @voteable = Voteable.new(params[:voteable]) 52 @voteable = Voteable.new(params[:voteable])
53 @voteable.user = current_user 53 @voteable.user = current_user
54 - 54 +
55 respond_to do |format| 55 respond_to do |format|
56 if @voteable.save 56 if @voteable.save
57 flash[:notice] = 'Voteable was successfully saved.' 57 flash[:notice] = 'Voteable was successfully saved.'
@@ -68,9 +68,9 @@ class VoteablesController &lt; ApplicationController @@ -68,9 +68,9 @@ class VoteablesController &lt; ApplicationController
68 # PUT /users/:id/voteable/1.xml 68 # PUT /users/:id/voteable/1.xml
69 def update 69 def update
70 @voteable = Voteable.find(params[:id]) 70 @voteable = Voteable.find(params[:id])
71 - 71 +
72 respond_to do |format| 72 respond_to do |format|
73 - if @quote.update_attributes(params[:voteable]) 73 + if @quote.update(params[:voteable])
74 flash[:notice] = 'Voteable was successfully updated.' 74 flash[:notice] = 'Voteable was successfully updated.'
75 format.html { redirect_to([@user, @voteable]) } 75 format.html { redirect_to([@user, @voteable]) }
76 format.xml { head :ok } 76 format.xml { head :ok }
@@ -92,17 +92,17 @@ class VoteablesController &lt; ApplicationController @@ -92,17 +92,17 @@ class VoteablesController &lt; ApplicationController
92 format.xml { head :ok } 92 format.xml { head :ok }
93 end 93 end
94 end 94 end
95 - 95 +
96 private 96 private
97 - def find_user 97 + def find_user
98 @user = User.find(params[:user_id]) 98 @user = User.find(params[:user_id])
99 end 99 end
100 - 100 +
101 def must_own_voteable 101 def must_own_voteable
102 @voteable ||= Voteable.find(params[:id]) 102 @voteable ||= Voteable.find(params[:id])
103 @voteable.user == current_user || ownership_violation 103 @voteable.user == current_user || ownership_violation
104 end 104 end
105 - 105 +
106 def ownership_violation 106 def ownership_violation
107 respond_to do |format| 107 respond_to do |format|
108 flash[:notice] = 'You cannot edit or delete voteable that you do not own!' 108 flash[:notice] = 'You cannot edit or delete voteable that you do not own!'
@@ -111,7 +111,7 @@ class VoteablesController &lt; ApplicationController @@ -111,7 +111,7 @@ class VoteablesController &lt; ApplicationController
111 end 111 end
112 end 112 end
113 end 113 end
114 -  
115 -  
116 - 114 +
  115 +
  116 +
117 end 117 end
vendor/plugins/kandadaboggu-vote_fu/lib/controllers/votes_controller.rb
1 class VotesController < ApplicationController 1 class VotesController < ApplicationController
2 # First, figure out our nested scope. User or vote? 2 # First, figure out our nested scope. User or vote?
3 # before_filter :find_my_scope 3 # before_filter :find_my_scope
4 - 4 +
5 # before_filter :find_user 5 # before_filter :find_user
6 - 6 +
7 # before_filter :login_required, :only => [:new, :edit, :destroy, :create, :update] 7 # before_filter :login_required, :only => [:new, :edit, :destroy, :create, :update]
8 # before_filter :must_own_vote, :only => [:edit, :destroy, :update] 8 # before_filter :must_own_vote, :only => [:edit, :destroy, :update]
9 9
@@ -70,7 +70,7 @@ class VotesController &lt; ApplicationController @@ -70,7 +70,7 @@ class VotesController &lt; ApplicationController
70 @vote = Vote.find(params[:id]) 70 @vote = Vote.find(params[:id])
71 71
72 respond_to do |format| 72 respond_to do |format|
73 - if @vote.update_attributes(params[:vote]) 73 + if @vote.update(params[:vote])
74 flash[:notice] = 'Vote was successfully updated.' 74 flash[:notice] = 'Vote was successfully updated.'
75 format.html { redirect_to([@user, @vote]) } 75 format.html { redirect_to([@user, @vote]) }
76 format.xml { head :ok } 76 format.xml { head :ok }