From d486c3ff8d7a02944552a529df632ae6ff632319 Mon Sep 17 00:00:00 2001 From: Braulio Bhavamitra Date: Sun, 13 Sep 2015 19:55:23 -0300 Subject: [PATCH] rails4: replace update_attributes with the new update --- app/controllers/admin/admin_panel_controller.rb | 4 ++-- app/controllers/admin/categories_controller.rb | 2 +- app/controllers/admin/features_controller.rb | 2 +- app/controllers/admin/licenses_controller.rb | 2 +- app/controllers/admin/plugins_controller.rb | 2 +- app/controllers/admin/role_controller.rb | 2 +- app/controllers/box_organizer_controller.rb | 2 +- app/controllers/my_profile/cms_controller.rb | 2 +- app/controllers/my_profile/enterprise_validation_controller.rb | 2 +- app/controllers/my_profile/manage_products_controller.rb | 8 ++++---- app/controllers/my_profile/maps_controller.rb | 2 +- app/controllers/my_profile/profile_editor_controller.rb | 4 ++-- app/controllers/my_profile/profile_roles_controller.rb | 2 +- app/controllers/my_profile/tasks_controller.rb | 2 +- app/controllers/public/account_controller.rb | 6 +++--- app/controllers/public/chat_controller.rb | 2 +- app/controllers/public/comment_controller.rb | 4 ++-- app/models/certifier.rb | 2 +- app/models/create_community.rb | 2 +- app/models/profile.rb | 2 +- features/step_definitions/noosfero_steps.rb | 6 +++--- lib/acts_as_having_posts.rb | 2 +- plugins/bsc/controllers/bsc_plugin_myprofile_controller.rb | 4 ++-- plugins/comment_classification/controllers/admin/comment_classification_plugin_labels_controller.rb | 2 +- plugins/comment_classification/controllers/admin/comment_classification_plugin_status_controller.rb | 2 +- plugins/comment_classification/controllers/comment_classification_plugin_myprofile_controller.rb | 2 +- plugins/driven_signup/controllers/admin/driven_signup_plugin/admin_controller.rb | 2 +- plugins/fb_app/controllers/public/fb_app_plugin_page_tab_controller.rb | 2 +- plugins/fb_app/models/fb_app_plugin/page_tab.rb | 2 +- plugins/lattes_curriculum/lib/lattes_curriculum_plugin.rb | 2 +- plugins/ldap/controllers/ldap_plugin_admin_controller.rb | 2 +- plugins/oauth_client/controllers/oauth_client_plugin_admin_controller.rb | 2 +- plugins/open_graph/controllers/myprofile/open_graph_plugin/myprofile_controller.rb | 2 +- plugins/open_graph/test/unit/open_graph_graph/publisher_test.rb | 4 ++-- plugins/organization_ratings/controllers/organization_ratings_plugin_admin_controller.rb | 4 ++-- plugins/piwik/controllers/piwik_plugin_admin_controller.rb | 2 +- plugins/send_email/controllers/send_email_plugin_admin_controller.rb | 2 +- plugins/sniffer/controllers/sniffer_plugin_myprofile_controller.rb | 2 +- plugins/tolerance_time/controllers/tolerance_time_plugin_myprofile_controller.rb | 2 +- script/apply-template | 2 +- test/functional/chat_controller_test.rb | 4 ++-- test/functional/content_viewer_controller_test.rb | 4 ++-- test/functional/features_controller_test.rb | 2 +- test/functional/mailconf_controller_test.rb | 2 +- test/functional/maps_controller_test.rb | 2 +- test/functional/profile_editor_controller_test.rb | 8 ++++---- test/functional/tasks_controller_test.rb | 10 +++++----- test/integration/signup_test.rb | 2 +- test/unit/block_test.rb | 2 +- test/unit/certifier_test.rb | 2 +- test/unit/highlights_block_test.rb | 2 +- test/unit/link_list_block_test.rb | 4 ++-- test/unit/my_network_block_test.rb | 2 +- test/unit/person_test.rb | 4 ++-- test/unit/recent_documents_block_test.rb | 2 +- test/unit/rss_feed_test.rb | 2 +- test/unit/user_test.rb | 4 ++-- vendor/plugins/action_tracker/lib/action_tracker_model.rb | 4 ++-- vendor/plugins/kandadaboggu-vote_fu/examples/voteables_controller.rb | 22 +++++++++++----------- vendor/plugins/kandadaboggu-vote_fu/lib/controllers/votes_controller.rb | 6 +++--- 60 files changed, 98 insertions(+), 98 deletions(-) diff --git a/app/controllers/admin/admin_panel_controller.rb b/app/controllers/admin/admin_panel_controller.rb index df51fa0..32f67ac 100644 --- a/app/controllers/admin/admin_panel_controller.rb +++ b/app/controllers/admin/admin_panel_controller.rb @@ -12,7 +12,7 @@ class AdminPanelController < AdminController if params[:environment][:languages] params[:environment][:languages] = params[:environment][:languages].map {|lang, value| lang if value=='true'}.compact end - if @environment.update_attributes(params[:environment]) + if @environment.update(params[:environment]) session[:notice] = _('Environment settings updated') redirect_to :action => 'index' end @@ -65,7 +65,7 @@ class AdminPanelController < AdminController def set_portal_news_amount if request.post? - if @environment.update_attributes(params[:environment]) + if @environment.update(params[:environment]) session[:notice] = _('Saved the number of news on folders') redirect_to :action => 'index' end diff --git a/app/controllers/admin/categories_controller.rb b/app/controllers/admin/categories_controller.rb index 0907c5d..75e5281 100644 --- a/app/controllers/admin/categories_controller.rb +++ b/app/controllers/admin/categories_controller.rb @@ -43,7 +43,7 @@ class CategoriesController < AdminController begin @category = environment.categories.find(params[:id]) if request.post? - @category.update_attributes!(params[:category]) + @category.update!(params[:category]) @saved = true session[:notice] = _("Category %s saved." % @category.name) redirect_to :action => 'index' diff --git a/app/controllers/admin/features_controller.rb b/app/controllers/admin/features_controller.rb index 4c2afc0..3892443 100644 --- a/app/controllers/admin/features_controller.rb +++ b/app/controllers/admin/features_controller.rb @@ -7,7 +7,7 @@ class FeaturesController < AdminController post_only :update def update - if @environment.update_attributes(params[:environment]) + if @environment.update(params[:environment]) session[:notice] = _('Features updated successfully.') redirect_to :action => 'index' else diff --git a/app/controllers/admin/licenses_controller.rb b/app/controllers/admin/licenses_controller.rb index 1cef9ca..7b693f8 100644 --- a/app/controllers/admin/licenses_controller.rb +++ b/app/controllers/admin/licenses_controller.rb @@ -23,7 +23,7 @@ class LicensesController < AdminController @license = environment.licenses.find(params[:license_id]) if request.post? begin - @license.update_attributes!(params[:license]) + @license.update!(params[:license]) session[:notice] = _('License updated') redirect_to :action => 'index' rescue diff --git a/app/controllers/admin/plugins_controller.rb b/app/controllers/admin/plugins_controller.rb index d75a701..204b915 100644 --- a/app/controllers/admin/plugins_controller.rb +++ b/app/controllers/admin/plugins_controller.rb @@ -8,7 +8,7 @@ class PluginsController < AdminController post_only :update def update params[:environment][:enabled_plugins].delete('') - if @environment.update_attributes(params[:environment]) + if @environment.update(params[:environment]) session[:notice] = _('Plugins updated successfully.') else session[:error] = _('Plugins were not updated successfully.') diff --git a/app/controllers/admin/role_controller.rb b/app/controllers/admin/role_controller.rb index d67da12..fd3b1d9 100644 --- a/app/controllers/admin/role_controller.rb +++ b/app/controllers/admin/role_controller.rb @@ -29,7 +29,7 @@ class RoleController < AdminController def update @role = environment.roles.find(params[:id]) - if @role.update_attributes(params[:role]) + if @role.update(params[:role]) redirect_to :action => 'show', :id => @role else session[:notice] = _('Failed to edit role') diff --git a/app/controllers/box_organizer_controller.rb b/app/controllers/box_organizer_controller.rb index 772e18d..ef1786e 100644 --- a/app/controllers/box_organizer_controller.rb +++ b/app/controllers/box_organizer_controller.rb @@ -98,7 +98,7 @@ class BoxOrganizerController < ApplicationController def save @block = boxes_holder.blocks.find(params[:id]) - @block.update_attributes(params[:block]) + @block.update(params[:block]) redirect_to :action => 'index' end diff --git a/app/controllers/my_profile/cms_controller.rb b/app/controllers/my_profile/cms_controller.rb index 9947d2b..4c47da3 100644 --- a/app/controllers/my_profile/cms_controller.rb +++ b/app/controllers/my_profile/cms_controller.rb @@ -93,7 +93,7 @@ class CmsController < MyProfileController @article.image.save! end @article.last_changed_by = user - if @article.update_attributes(params[:article]) + if @article.update(params[:article]) if !continue if @article.content_type.nil? || @article.image? success_redirect diff --git a/app/controllers/my_profile/enterprise_validation_controller.rb b/app/controllers/my_profile/enterprise_validation_controller.rb index 7375ec0..926fae2 100644 --- a/app/controllers/my_profile/enterprise_validation_controller.rb +++ b/app/controllers/my_profile/enterprise_validation_controller.rb @@ -54,7 +54,7 @@ class EnterpriseValidationController < MyProfileController def edit_validation_info @info = profile.validation_info if request.post? - if @info.update_attributes(params[:info]) + if @info.update(params[:info]) redirect_to :action => 'index' end end diff --git a/app/controllers/my_profile/manage_products_controller.rb b/app/controllers/my_profile/manage_products_controller.rb index 84d267c..ea23fc6 100644 --- a/app/controllers/my_profile/manage_products_controller.rb +++ b/app/controllers/my_profile/manage_products_controller.rb @@ -69,7 +69,7 @@ class ManageProductsController < ApplicationController field = params[:field] if request.post? begin - @product.update_attributes!(params[:product]) + @product.update!(params[:product]) render :partial => "display_#{field}", :locals => {:product => @product} rescue Exception => e render :partial => "edit_#{field}", :locals => {:product => @product, :errors => true} @@ -86,7 +86,7 @@ class ManageProductsController < ApplicationController @edit = true @level = @category.level if request.post? - if @product.update_attributes({:product_category_id => params[:selected_category_id]}, :without_protection => true) + if @product.update({:product_category_id => params[:selected_category_id]}, :without_protection => true) render :partial => 'shared/redirect_via_javascript', :locals => { :url => url_for(:controller => 'manage_products', :action => 'show', :id => @product) } else @@ -115,7 +115,7 @@ class ManageProductsController < ApplicationController @categories = ProductCategory.top_level_for(environment) @level = 0 if request.post? - if @input.update_attributes(:product_category_id => params[:selected_category_id]) + if @input.update(:product_category_id => params[:selected_category_id]) @inputs = @product.inputs render :partial => 'display_inputs' else @@ -172,7 +172,7 @@ class ManageProductsController < ApplicationController @input = @profile.inputs.find_by_id(params[:id]) if @input if request.post? - if @input.update_attributes(params[:input]) + if @input.update(params[:input]) render :partial => 'display_input', :locals => {:input => @input} else render :partial => 'edit_input' diff --git a/app/controllers/my_profile/maps_controller.rb b/app/controllers/my_profile/maps_controller.rb index 6fdff27..d4e9649 100644 --- a/app/controllers/my_profile/maps_controller.rb +++ b/app/controllers/my_profile/maps_controller.rb @@ -15,7 +15,7 @@ class MapsController < MyProfileController end Profile.transaction do - if profile.update_attributes!(params[:profile_data]) + if profile.update!(params[:profile_data]) BlockSweeper.expire_blocks profile.blocks.select{ |b| b.class == LocationBlock } session[:notice] = _('Address was updated successfully!') redirect_to :action => 'edit_location' diff --git a/app/controllers/my_profile/profile_editor_controller.rb b/app/controllers/my_profile/profile_editor_controller.rb index f49823a..3960bc5 100644 --- a/app/controllers/my_profile/profile_editor_controller.rb +++ b/app/controllers/my_profile/profile_editor_controller.rb @@ -24,7 +24,7 @@ class ProfileEditorController < MyProfileController Image.transaction do begin @plugins.dispatch(:profile_editor_transaction_extras) - @profile_data.update_attributes!(params[:profile_data]) + @profile_data.update!(params[:profile_data]) redirect_to :action => 'index', :profile => profile.identifier rescue Exception => ex profile.identifier = params[:profile] if profile.identifier.blank? @@ -94,7 +94,7 @@ class ProfileEditorController < MyProfileController @welcome_page = profile.welcome_page || TinyMceArticle.new(:name => 'Welcome Page', :profile => profile, :published => false) if request.post? begin - @welcome_page.update_attributes!(params[:welcome_page]) + @welcome_page.update!(params[:welcome_page]) profile.welcome_page = @welcome_page profile.save! session[:notice] = _('Welcome page saved successfully.') diff --git a/app/controllers/my_profile/profile_roles_controller.rb b/app/controllers/my_profile/profile_roles_controller.rb index 51b8c2f..3063bce 100644 --- a/app/controllers/my_profile/profile_roles_controller.rb +++ b/app/controllers/my_profile/profile_roles_controller.rb @@ -58,7 +58,7 @@ class ProfileRolesController < MyProfileController def update @role = environment.roles.find(params[:id]) - if @role.update_attributes(params[:role]) + if @role.update(params[:role]) redirect_to :action => 'show', :id => @role else session[:notice] = _('Failed to edit role') diff --git a/app/controllers/my_profile/tasks_controller.rb b/app/controllers/my_profile/tasks_controller.rb index 976c0cc..ca536c9 100644 --- a/app/controllers/my_profile/tasks_controller.rb +++ b/app/controllers/my_profile/tasks_controller.rb @@ -48,7 +48,7 @@ class TasksController < MyProfileController if request.post? && VALID_DECISIONS.include?(decision) && id && decision != 'skip' task = profile.find_in_all_tasks(id) begin - task.update_attributes(value[:task]) + task.update(value[:task]) task.send(decision, current_person) rescue Exception => ex message = "#{task.title} (#{task.requestor ? task.requestor.name : task.author_name})" diff --git a/app/controllers/public/account_controller.rb b/app/controllers/public/account_controller.rb index 860aa5c..04b2de1 100644 --- a/app/controllers/public/account_controller.rb +++ b/app/controllers/public/account_controller.rb @@ -119,7 +119,7 @@ class AccountController < ApplicationController @user.person.affiliate(@user.person, [owner_role]) if owner_role invitation = Task.from_code(@invitation_code).first if invitation - invitation.update_attributes! friend: @user.person + invitation.update! friend: @user.person invitation.finish end @@ -218,7 +218,7 @@ class AccountController < ApplicationController if request.post? begin - @change_password.update_attributes!(params[:change_password]) + @change_password.update!(params[:change_password]) @change_password.finish render :action => 'new_password_ok' rescue ActiveRecord::RecordInvalid => e @@ -487,7 +487,7 @@ class AccountController < ApplicationController def check_redirection unless params[:redirection].blank? session[:return_to] = @user.return_to - @user.update_attributes(:return_to => nil) + @user.update(:return_to => nil) end end diff --git a/app/controllers/public/chat_controller.rb b/app/controllers/public/chat_controller.rb index a88051b..ebe0a9b 100644 --- a/app/controllers/public/chat_controller.rb +++ b/app/controllers/public/chat_controller.rb @@ -67,7 +67,7 @@ class ChatController < PublicController def update_presence_status if request.xhr? - current_user.update_attributes({:chat_status_at => DateTime.now}.merge(params[:status] || {})) + current_user.update({:chat_status_at => DateTime.now}.merge(params[:status] || {})) end render :nothing => true end diff --git a/app/controllers/public/comment_controller.rb b/app/controllers/public/comment_controller.rb index 37bc0b3..ec719f3 100644 --- a/app/controllers/public/comment_controller.rb +++ b/app/controllers/public/comment_controller.rb @@ -78,7 +78,7 @@ class CommentController < ApplicationController respond_to do |format| format.js do comment_to_render = @comment.comment_root - render :json => { + render :json => { :render_target => comment_to_render.anchor, :html => render_to_string(:partial => 'comment', :locals => {:comment => comment_to_render, :display_link => true}), :msg => _('Comment successfully created.') @@ -114,7 +114,7 @@ class CommentController < ApplicationController end def update - if @comment.update_attributes(params[:comment]) + if @comment.update(params[:comment]) @plugins.dispatch(:process_extra_comment_params, [@comment,params]) respond_to do |format| diff --git a/app/models/certifier.rb b/app/models/certifier.rb index 0412d3e..0d5bd8c 100644 --- a/app/models/certifier.rb +++ b/app/models/certifier.rb @@ -20,7 +20,7 @@ class Certifier < ActiveRecord::Base validates_presence_of :name def destroy - product_qualifiers.each { |pq| pq.update_attributes! :certifier => nil } + product_qualifiers.each { |pq| pq.update! :certifier => nil } super end diff --git a/app/models/create_community.rb b/app/models/create_community.rb index 91df0f3..ac9a300 100644 --- a/app/models/create_community.rb +++ b/app/models/create_community.rb @@ -30,7 +30,7 @@ class CreateCommunity < Task ! DATA_FIELDS.include?(key.to_s) end - community.update_attributes(community_data) + community.update(community_data) community.image = image if image community.environment = self.environment community.save! diff --git a/app/models/profile.rb b/app/models/profile.rb index db54ab4..e4d57ff 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -720,7 +720,7 @@ private :generate_url, :url_options num = num + 1 new_name = original_article.name + ' ' + num.to_s end - original_article.update_attributes!(:name => new_name) + original_article.update!(:name => new_name) end article_copy = article.copy(:profile => self, :parent => parent, :advertise => false) if article.profile.home_page == article diff --git a/features/step_definitions/noosfero_steps.rb b/features/step_definitions/noosfero_steps.rb index 355d899..f84e19b 100644 --- a/features/step_definitions/noosfero_steps.rb +++ b/features/step_definitions/noosfero_steps.rb @@ -15,12 +15,12 @@ Given /^the following users?$/ do |table| end Given /^"(.+)" is (invisible|visible)$/ do |user, visibility| - User.find_by_login(user).person.update_attributes({:visible => (visibility == 'visible')}, :without_protection => true) + User.find_by_login(user).person.update({:visible => (visibility == 'visible')}, :without_protection => true) end Given /^"(.+)" is (online|offline|busy) in chat$/ do |user, status| status = {'online' => 'chat', 'offline' => '', 'busy' => 'dnd'}[status] - User.find_by_login(user).update_attributes(:chat_status => status, :chat_status_at => DateTime.now) + User.find_by_login(user).update(:chat_status => status, :chat_status_at => DateTime.now) end Given /^the following (community|communities|enterprises?|organizations?)$/ do |kind,table| @@ -680,7 +680,7 @@ end Given /^the article "([^\"]*)" is updated with$/ do |article, table| a = Article.find_by_name article row = table.hashes.first - a.update_attributes(row) + a.update(row) end Given /^the cache is turned (on|off)$/ do |state| diff --git a/lib/acts_as_having_posts.rb b/lib/acts_as_having_posts.rb index 8755b55..701823a 100644 --- a/lib/acts_as_having_posts.rb +++ b/lib/acts_as_having_posts.rb @@ -28,7 +28,7 @@ module ActsAsHavingPosts def feed=(attrs) if attrs if self.feed - self.feed.update_attributes(attrs) + self.feed.update(attrs) else self.feed_attrs = attrs end diff --git a/plugins/bsc/controllers/bsc_plugin_myprofile_controller.rb b/plugins/bsc/controllers/bsc_plugin_myprofile_controller.rb index 89b855e..798d7da 100644 --- a/plugins/bsc/controllers/bsc_plugin_myprofile_controller.rb +++ b/plugins/bsc/controllers/bsc_plugin_myprofile_controller.rb @@ -140,7 +140,7 @@ class BscPluginMyprofileController < MyProfileController session[:notice] = _('Could not edit such contract.') redirect_to :action => 'manage_contracts' end - if request.post? && @contract.update_attributes(params[:contract]) + if request.post? && @contract.update(params[:contract]) # updating associated enterprises enterprises_ids = params[:enterprises] || '' @@ -159,7 +159,7 @@ class BscPluginMyprofileController < MyProfileController to_keep.each do |sale_attrs| sale = @contract.sales.find_by_product_id(sale_attrs[:product_id]) - sale.update_attributes!(sale_attrs) + sale.update!(sale_attrs) sales.delete(sale_attrs) end diff --git a/plugins/comment_classification/controllers/admin/comment_classification_plugin_labels_controller.rb b/plugins/comment_classification/controllers/admin/comment_classification_plugin_labels_controller.rb index e196eef..c6d2a07 100644 --- a/plugins/comment_classification/controllers/admin/comment_classification_plugin_labels_controller.rb +++ b/plugins/comment_classification/controllers/admin/comment_classification_plugin_labels_controller.rb @@ -27,7 +27,7 @@ class CommentClassificationPluginLabelsController < AdminController @colors = CommentClassificationPlugin::Label::COLORS if request.post? begin - @label.update_attributes!(params[:label]) + @label.update!(params[:label]) session[:notice] = _('Label updated') redirect_to :action => :index rescue diff --git a/plugins/comment_classification/controllers/admin/comment_classification_plugin_status_controller.rb b/plugins/comment_classification/controllers/admin/comment_classification_plugin_status_controller.rb index af0f4a0..e76b60d 100644 --- a/plugins/comment_classification/controllers/admin/comment_classification_plugin_status_controller.rb +++ b/plugins/comment_classification/controllers/admin/comment_classification_plugin_status_controller.rb @@ -25,7 +25,7 @@ class CommentClassificationPluginStatusController < AdminController @status = CommentClassificationPlugin::Status.find(params[:id]) if request.post? begin - @status.update_attributes!(params[:status]) + @status.update!(params[:status]) session[:notice] = _('Status updated') redirect_to :action => :index rescue diff --git a/plugins/comment_classification/controllers/comment_classification_plugin_myprofile_controller.rb b/plugins/comment_classification/controllers/comment_classification_plugin_myprofile_controller.rb index db98137..7fee809 100644 --- a/plugins/comment_classification/controllers/comment_classification_plugin_myprofile_controller.rb +++ b/plugins/comment_classification/controllers/comment_classification_plugin_myprofile_controller.rb @@ -13,7 +13,7 @@ class CommentClassificationPluginMyprofileController < MyProfileController @statuses = CommentClassificationPlugin::Status.enabled @status = CommentClassificationPlugin::CommentStatusUser.new(:profile => user, :comment => @comment) if request.post? && params[:status] - @status.update_attributes(params[:status]) + @status.update(params[:status]) @status.save end end diff --git a/plugins/driven_signup/controllers/admin/driven_signup_plugin/admin_controller.rb b/plugins/driven_signup/controllers/admin/driven_signup_plugin/admin_controller.rb index 2bbef3a..c09f29a 100644 --- a/plugins/driven_signup/controllers/admin/driven_signup_plugin/admin_controller.rb +++ b/plugins/driven_signup/controllers/admin/driven_signup_plugin/admin_controller.rb @@ -15,7 +15,7 @@ class DrivenSignupPlugin::AdminController < AdminController def edit @auth = environment.driven_signup_auths.where(id: params[:id]).first @auth ||= environment.driven_signup_auths.build - @auth.update_attributes params[:auth] + @auth.update params[:auth] end def destroy diff --git a/plugins/fb_app/controllers/public/fb_app_plugin_page_tab_controller.rb b/plugins/fb_app/controllers/public/fb_app_plugin_page_tab_controller.rb index 142a23e..31235c5 100644 --- a/plugins/fb_app/controllers/public/fb_app_plugin_page_tab_controller.rb +++ b/plugins/fb_app/controllers/public/fb_app_plugin_page_tab_controller.rb @@ -68,7 +68,7 @@ class FbAppPluginPageTabController < FbAppPluginController if request.put? and @page_id.present? create_page_tabs if @page_tab.nil? - @page_tab.update_attributes! params[:page_tab] + @page_tab.update! params[:page_tab] respond_to do |format| format.js{ render action: 'admin' } diff --git a/plugins/fb_app/models/fb_app_plugin/page_tab.rb b/plugins/fb_app/models/fb_app_plugin/page_tab.rb index 6f79bb8..3d8c742 100644 --- a/plugins/fb_app/models/fb_app_plugin/page_tab.rb +++ b/plugins/fb_app/models/fb_app_plugin/page_tab.rb @@ -27,7 +27,7 @@ class FbAppPlugin::PageTab < ActiveRecord::Base page_ids.map do |page_id| page_tab = FbAppPlugin::PageTab.where(page_id: page_id).first page_tab ||= FbAppPlugin::PageTab.new page_id: page_id - page_tab.update_attributes! attrs + page_tab.update! attrs page_tab end end diff --git a/plugins/lattes_curriculum/lib/lattes_curriculum_plugin.rb b/plugins/lattes_curriculum/lib/lattes_curriculum_plugin.rb index 6bf5cae..da3db25 100755 --- a/plugins/lattes_curriculum/lib/lattes_curriculum_plugin.rb +++ b/plugins/lattes_curriculum/lib/lattes_curriculum_plugin.rb @@ -129,7 +129,7 @@ class LattesCurriculumPlugin < Noosfero::Plugin def academic_info_transaction AcademicInfo.transaction do - context.profile.academic_info.update_attributes!(context.params[:academic_infos]) + context.profile.academic_info.update!(context.params[:academic_infos]) end end diff --git a/plugins/ldap/controllers/ldap_plugin_admin_controller.rb b/plugins/ldap/controllers/ldap_plugin_admin_controller.rb index 207f178..8753433 100644 --- a/plugins/ldap/controllers/ldap_plugin_admin_controller.rb +++ b/plugins/ldap/controllers/ldap_plugin_admin_controller.rb @@ -6,7 +6,7 @@ class LdapPluginAdminController < PluginAdminController end def update - if @environment.update_attributes(params[:environment]) + if @environment.update(params[:environment]) session[:notice] = _('Ldap configuration updated successfully.') else session[:notice] = _('Ldap configuration could not be saved.') diff --git a/plugins/oauth_client/controllers/oauth_client_plugin_admin_controller.rb b/plugins/oauth_client/controllers/oauth_client_plugin_admin_controller.rb index 5b8f535..3e4e370 100644 --- a/plugins/oauth_client/controllers/oauth_client_plugin_admin_controller.rb +++ b/plugins/oauth_client/controllers/oauth_client_plugin_admin_controller.rb @@ -16,7 +16,7 @@ class OauthClientPluginAdminController < AdminController def edit @provider = params[:id] ? environment.oauth_providers.find(params[:id]) : environment.oauth_providers.new if request.post? - if @provider.update_attributes(params['oauth_client_plugin_provider']) + if @provider.update(params['oauth_client_plugin_provider']) session[:notice] = _('Saved!') else session[:notice] = _('Error!') diff --git a/plugins/open_graph/controllers/myprofile/open_graph_plugin/myprofile_controller.rb b/plugins/open_graph/controllers/myprofile/open_graph_plugin/myprofile_controller.rb index c10f15a..4aededb 100644 --- a/plugins/open_graph/controllers/myprofile/open_graph_plugin/myprofile_controller.rb +++ b/plugins/open_graph/controllers/myprofile/open_graph_plugin/myprofile_controller.rb @@ -17,7 +17,7 @@ class OpenGraphPlugin::MyprofileController < MyProfileController end def track_config - profile.update_attributes! params[:profile_data] + profile.update! params[:profile_data] render partial: 'track_form', locals: {context: context, reload: true} end diff --git a/plugins/open_graph/test/unit/open_graph_graph/publisher_test.rb b/plugins/open_graph/test/unit/open_graph_graph/publisher_test.rb index 57d05cf..d73c3be 100644 --- a/plugins/open_graph/test/unit/open_graph_graph/publisher_test.rb +++ b/plugins/open_graph/test/unit/open_graph_graph/publisher_test.rb @@ -25,7 +25,7 @@ class OpenGraphPlugin::PublisherTest < ActiveSupport::TestCase @community = @actor.environment.communities.create! name: 'comm', identifier: 'comm', closed: false - @actor.update_attributes!({ + @actor.update!({ open_graph_settings: { activity_track_enabled: "true", enterprise_track_enabled: "true", @@ -43,7 +43,7 @@ class OpenGraphPlugin::PublisherTest < ActiveSupport::TestCase open_graph_enterprise_profiles_ids: "#{@enterprise.id}", open_graph_community_profiles_ids: "#{@community.id}", }) - @other_actor.update_attributes! open_graph_settings: { activity_track_enabled: "true", }, + @other_actor.update! open_graph_settings: { activity_track_enabled: "true", }, open_graph_activity_track_configs_attributes: { 0 => { tracker_id: @other_actor.id, object_type: 'friend', }, } # active diff --git a/plugins/organization_ratings/controllers/organization_ratings_plugin_admin_controller.rb b/plugins/organization_ratings/controllers/organization_ratings_plugin_admin_controller.rb index 7e9c356..e2936af 100644 --- a/plugins/organization_ratings/controllers/organization_ratings_plugin_admin_controller.rb +++ b/plugins/organization_ratings/controllers/organization_ratings_plugin_admin_controller.rb @@ -8,7 +8,7 @@ class OrganizationRatingsPluginAdminController < PluginAdminController end def update - if env_organization_ratings_config.update_attributes(params[:organization_ratings_config]) + if env_organization_ratings_config.update(params[:organization_ratings_config]) session[:notice] = _('Configuration updated successfully.') else session[:notice] = _('Configuration could not be saved.') @@ -16,4 +16,4 @@ class OrganizationRatingsPluginAdminController < PluginAdminController render :action => 'index' end -end \ No newline at end of file +end diff --git a/plugins/piwik/controllers/piwik_plugin_admin_controller.rb b/plugins/piwik/controllers/piwik_plugin_admin_controller.rb index 906af94..a6c444f 100644 --- a/plugins/piwik/controllers/piwik_plugin_admin_controller.rb +++ b/plugins/piwik/controllers/piwik_plugin_admin_controller.rb @@ -4,7 +4,7 @@ class PiwikPluginAdminController < PluginAdminController def index if request.post? - if @environment.update_attributes(params[:environment]) + if @environment.update(params[:environment]) session[:notice] = _('Piwik plugin settings updated successfully.') else session[:notice] = _('Piwik plugin settings could not be saved.') diff --git a/plugins/send_email/controllers/send_email_plugin_admin_controller.rb b/plugins/send_email/controllers/send_email_plugin_admin_controller.rb index e4c1ec8..767ff08 100644 --- a/plugins/send_email/controllers/send_email_plugin_admin_controller.rb +++ b/plugins/send_email/controllers/send_email_plugin_admin_controller.rb @@ -3,7 +3,7 @@ class SendEmailPluginAdminController < PluginsController def index @environment = environment if request.post? - if environment.update_attributes(params[:environment]) + if environment.update(params[:environment]) session[:notice] = _('Configurations was saved') redirect_to :controller => 'plugins' else diff --git a/plugins/sniffer/controllers/sniffer_plugin_myprofile_controller.rb b/plugins/sniffer/controllers/sniffer_plugin_myprofile_controller.rb index 94edb2d..fbc20ea 100644 --- a/plugins/sniffer/controllers/sniffer_plugin_myprofile_controller.rb +++ b/plugins/sniffer/controllers/sniffer_plugin_myprofile_controller.rb @@ -9,7 +9,7 @@ class SnifferPluginMyprofileController < MyProfileController def edit if request.post? begin - @sniffer_profile.update_attributes(params[:sniffer_plugin_profile]) + @sniffer_profile.update(params[:sniffer_plugin_profile]) @sniffer_profile.enabled = true @sniffer_profile.save! session[:notice] = _('Consumer interests updated') diff --git a/plugins/tolerance_time/controllers/tolerance_time_plugin_myprofile_controller.rb b/plugins/tolerance_time/controllers/tolerance_time_plugin_myprofile_controller.rb index 391dddc..1ee780a 100644 --- a/plugins/tolerance_time/controllers/tolerance_time_plugin_myprofile_controller.rb +++ b/plugins/tolerance_time/controllers/tolerance_time_plugin_myprofile_controller.rb @@ -5,7 +5,7 @@ class ToleranceTimePluginMyprofileController < MyProfileController if request.post? begin convert_params - @tolerance.update_attributes!(params[:tolerance]) + @tolerance.update!(params[:tolerance]) convert_values session[:notice] = _('Tolerance updated') rescue diff --git a/script/apply-template b/script/apply-template index f001dc4..d48bad5 100755 --- a/script/apply-template +++ b/script/apply-template @@ -46,7 +46,7 @@ when 'active-enterprise' active_enterprises.each do |enterprise| old_home = enterprise.home_page enterprise.apply_template(env.enterprise_template) - enterprise.home_page.update_attributes!(:body => old_home.body) + enterprise.home_page.update!(:body => old_home.body) enterprise.save! end when 'community' diff --git a/test/functional/chat_controller_test.rb b/test/functional/chat_controller_test.rb index 44d3720..be0e92c 100644 --- a/test/functional/chat_controller_test.rb +++ b/test/functional/chat_controller_test.rb @@ -73,14 +73,14 @@ class ChatControllerTest < ActionController::TestCase end should 'not update presence status from non-ajax requests' do - @person.user.expects(:update_attributes).never + @person.user.expects(:update).never @controller.stubs(:current_user).returns(@person.user) get :update_presence_status assert_template nil end should 'update presence status from ajax requests' do - @person.user.expects(:update_attributes).once + @person.user.expects(:update).once @controller.stubs(:current_user).returns(@person.user) @request.stubs(:xhr?).returns(true) get :update_presence_status diff --git a/test/functional/content_viewer_controller_test.rb b/test/functional/content_viewer_controller_test.rb index 5c09402..c21e401 100644 --- a/test/functional/content_viewer_controller_test.rb +++ b/test/functional/content_viewer_controller_test.rb @@ -144,7 +144,7 @@ class ContentViewerControllerTest < ActionController::TestCase should 'not display forbidden articles' do profile.articles.create!(:name => 'test') - profile.update_attributes!({:public_content => false}, :without_protection => true) + profile.update!({:public_content => false}, :without_protection => true) Article.any_instance.expects(:display_to?).with(anything).returns(false) get :view_page, :profile => profile.identifier, :page => [ 'test' ] @@ -153,7 +153,7 @@ class ContentViewerControllerTest < ActionController::TestCase should 'display allowed articles' do profile.articles.create!(:name => 'test') - profile.update_attributes!({:public_content => false}, :without_protection => true) + profile.update!({:public_content => false}, :without_protection => true) Article.any_instance.expects(:display_to?).with(anything).returns(true) get :view_page, :profile => profile.identifier, :page => [ 'test' ] diff --git a/test/functional/features_controller_test.rb b/test/functional/features_controller_test.rb index 5cce15f..c1a68de 100644 --- a/test/functional/features_controller_test.rb +++ b/test/functional/features_controller_test.rb @@ -66,7 +66,7 @@ class FeaturesControllerTest < ActionController::TestCase def test_should_mark_current_organization_approval_method_in_view uses_host 'anhetegua.net' - Environment.find(environments(:anhetegua_net).id).update_attributes(:organization_approval_method => :region) + Environment.find(environments(:anhetegua_net).id).update(:organization_approval_method => :region) post :index diff --git a/test/functional/mailconf_controller_test.rb b/test/functional/mailconf_controller_test.rb index 09fb792..d039461 100644 --- a/test/functional/mailconf_controller_test.rb +++ b/test/functional/mailconf_controller_test.rb @@ -60,7 +60,7 @@ class MailconfControllerTest < ActionController::TestCase should 'display correctly the state false of e-mail enable/disable' do login_as('ze') - user.update_attributes!(:enable_email => false) + user.update!(:enable_email => false) get :index, :profile => 'ze' assert_tag :tag => 'a', :content => 'Enable e-Mail' assert_no_tag :tag => 'a', :content => 'Disable e-Mail', :attributes => { :href => '/myprofile/ze/mailconf/disable' } diff --git a/test/functional/maps_controller_test.rb b/test/functional/maps_controller_test.rb index d078d14..d3abeab 100644 --- a/test/functional/maps_controller_test.rb +++ b/test/functional/maps_controller_test.rb @@ -51,7 +51,7 @@ class MapsControllerTest < ActionController::TestCase end should 'back when update address fail' do - Profile.any_instance.stubs(:update_attributes!).returns(false) + Profile.any_instance.stubs(:update!).returns(false) post :edit_location, :profile => profile.identifier, :profile_data => { 'address' => 'new address' } assert_nil profile.address assert_template 'edit_location' diff --git a/test/functional/profile_editor_controller_test.rb b/test/functional/profile_editor_controller_test.rb index a55231d..16aa753 100644 --- a/test/functional/profile_editor_controller_test.rb +++ b/test/functional/profile_editor_controller_test.rb @@ -196,7 +196,7 @@ class ProfileEditorControllerTest < ActionController::TestCase end should 'display properly that the profile is non-public' do - profile.update_attributes!(:public_profile => false) + profile.update!(:public_profile => false) get :edit, :profile => profile.identifier assert_tag :tag => 'input', :attributes => { :type => 'radio', :checked => 'checked', :name => 'profile_data[public_profile]', :value => 'false' } assert_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'profile_data[public_profile]', :value => 'true' } @@ -227,7 +227,7 @@ class ProfileEditorControllerTest < ActionController::TestCase should 'back when update community info fail' do org = fast_create(Community) - Community.any_instance.expects(:update_attributes!).raises(ActiveRecord::RecordInvalid) + Community.any_instance.expects(:update!).raises(ActiveRecord::RecordInvalid) post :edit, :profile => org.identifier assert_template 'edit' @@ -237,7 +237,7 @@ class ProfileEditorControllerTest < ActionController::TestCase should 'back when update enterprise info fail' do org = fast_create(Enterprise) - Enterprise.any_instance.expects(:update_attributes!).raises(ActiveRecord::RecordInvalid) + Enterprise.any_instance.expects(:update!).raises(ActiveRecord::RecordInvalid) post :edit, :profile => org.identifier assert_template 'edit' assert_response :success @@ -801,7 +801,7 @@ class ProfileEditorControllerTest < ActionController::TestCase end should 'show profile nickname on title' do - profile.update_attributes(:nickname => 'my nick') + profile.update(:nickname => 'my nick') get :index, :profile => profile.identifier assert_tag :tag => 'h1', :attributes => { :class => 'block-title'}, :descendant => { :tag => 'span', :attributes => { :class => 'control-panel-title' }, :content => 'my nick' diff --git a/test/functional/tasks_controller_test.rb b/test/functional/tasks_controller_test.rb index b646f4d..d1fdbc6 100644 --- a/test/functional/tasks_controller_test.rb +++ b/test/functional/tasks_controller_test.rb @@ -123,7 +123,7 @@ class TasksControllerTest < ActionController::TestCase post :close, :tasks => {t.id => {:decision => 'finish', :task => {}}} t.reload - + ok('task should be finished') { t.status == Task::Status::FINISHED } c.reload @@ -190,7 +190,7 @@ class TasksControllerTest < ActionController::TestCase should 'create article with reference_article after finish approve article task' do c = fast_create(Community) - c.update_attributes(:moderated_articles => false) + c.update(:moderated_articles => false) @controller.stubs(:profile).returns(c) c.affiliate(profile, Profile::Roles.all_roles(profile.environment.id)) article = profile.articles.create!(:name => 'something interesting', :body => 'ruby on rails') @@ -202,7 +202,7 @@ class TasksControllerTest < ActionController::TestCase should 'create published article in folder after finish approve article task' do c = fast_create(Community) - c.update_attributes(:moderated_articles => false) + c.update(:moderated_articles => false) @controller.stubs(:profile).returns(c) folder = create(Folder, :profile => c, :name => 'test folder') c.affiliate(profile, Profile::Roles.all_roles(profile.environment.id)) @@ -215,7 +215,7 @@ class TasksControllerTest < ActionController::TestCase should 'be highlighted if asked when approving a published article' do c = fast_create(Community) - c.update_attributes(:moderated_articles => false) + c.update(:moderated_articles => false) @controller.stubs(:profile).returns(c) folder = create(Article, :profile => c, :name => 'test folder', :type => 'Folder') c.affiliate(profile, Profile::Roles.all_roles(profile.environment.id)) @@ -228,7 +228,7 @@ class TasksControllerTest < ActionController::TestCase should 'create article of same class after choosing root folder on approve article task' do c = fast_create(Community) - c.update_attributes(:moderated_articles => false) + c.update(:moderated_articles => false) @controller.stubs(:profile).returns(c) c.affiliate(profile, Profile::Roles.all_roles(profile.environment.id)) article = profile.articles.create!(:name => 'something interesting', :body => 'ruby on rails') diff --git a/test/integration/signup_test.rb b/test/integration/signup_test.rb index 7f065cd..e4ee1e5 100644 --- a/test/integration/signup_test.rb +++ b/test/integration/signup_test.rb @@ -24,7 +24,7 @@ class SignupTest < ActionDispatch::IntegrationTest def test_should_require_acceptance_of_terms_for_signup env = Environment.default - env.update_attributes(:terms_of_use => 'You agree to not be annoying.') + env.update(:terms_of_use => 'You agree to not be annoying.') env.min_signup_delay = 0 env.save! diff --git a/test/unit/block_test.rb b/test/unit/block_test.rb index 5e6fbff..ca16490 100644 --- a/test/unit/block_test.rb +++ b/test/unit/block_test.rb @@ -136,7 +136,7 @@ class BlockTest < ActiveSupport::TestCase user = create_user('testinguser').person box = fast_create(Box, :owner_id => user.id, :owner_type => 'Profile') block = create(Block, :display => 'never', :box_id => box.id) - assert block.update_attributes!(:display => 'always') + assert block.update!(:display => 'always') block.reload assert_equal 'always', block.display end diff --git a/test/unit/certifier_test.rb b/test/unit/certifier_test.rb index 387b9b5..4f37639 100644 --- a/test/unit/certifier_test.rb +++ b/test/unit/certifier_test.rb @@ -62,7 +62,7 @@ class CertifierTest < ActiveSupport::TestCase should 'set qualifier as self-certified when destroyed' do pq = mock Certifier.any_instance.stubs(:product_qualifiers).returns([pq]) - pq.expects(:update_attributes!).with(:certifier => nil) + pq.expects(:update!).with(:certifier => nil) cert = fast_create(Certifier) cert.destroy end diff --git a/test/unit/highlights_block_test.rb b/test/unit/highlights_block_test.rb index b4a411a..25036f1 100644 --- a/test/unit/highlights_block_test.rb +++ b/test/unit/highlights_block_test.rb @@ -63,7 +63,7 @@ class HighlightsBlockTest < ActiveSupport::TestCase block = HighlightsBlock.create!(:display => 'never').tap do |b| b.box = box end - assert block.update_attributes!(:display => 'always') + assert block.update!(:display => 'always') block.reload assert_equal 'always', block.display end diff --git a/test/unit/link_list_block_test.rb b/test/unit/link_list_block_test.rb index 73d069f..44042ab 100644 --- a/test/unit/link_list_block_test.rb +++ b/test/unit/link_list_block_test.rb @@ -10,7 +10,7 @@ class LinkListBlockTest < ActiveSupport::TestCase l = LinkListBlock.new assert_respond_to l, :links end - + should 'default value of links' do l = LinkListBlock.new assert_equal [], l.links @@ -117,7 +117,7 @@ class LinkListBlockTest < ActiveSupport::TestCase block = LinkListBlock.new(:display => 'never').tap do |b| b.box = box end - assert block.update_attributes!(:display => 'always') + assert block.update!(:display => 'always') block.reload assert_equal 'always', block.display end diff --git a/test/unit/my_network_block_test.rb b/test/unit/my_network_block_test.rb index 9e92647..8513a3d 100644 --- a/test/unit/my_network_block_test.rb +++ b/test/unit/my_network_block_test.rb @@ -31,7 +31,7 @@ class MyNetworkBlockTest < ActiveSupport::TestCase user = create_user('testinguser').person box = fast_create(Box, :owner_id => user.id) block = MyNetworkBlock.create!(:display => 'never', :box => box) - assert block.update_attributes!(:display => 'always') + assert block.update!(:display => 'always') block.reload assert_equal 'always', block.display end diff --git a/test/unit/person_test.rb b/test/unit/person_test.rb index de9e047..93e4d2d 100644 --- a/test/unit/person_test.rb +++ b/test/unit/person_test.rb @@ -153,7 +153,7 @@ class PersonTest < ActiveSupport::TestCase person = create_user('just_another_person').person env.affiliate(person, role) refute person.is_admin?(env) - role.update_attributes(:permissions => ['view_environment_admin_panel']) + role.update(:permissions => ['view_environment_admin_panel']) person = Person.find(person.id) assert person.is_admin?(env) end @@ -164,7 +164,7 @@ class PersonTest < ActiveSupport::TestCase # role is an admin role role = create(Role, :name => 'just_another_admin_role') - role.update_attributes(:permissions => ['view_environment_admin_panel']) + role.update(:permissions => ['view_environment_admin_panel']) # user is admin of env1, but not of env2 person = create_user('just_another_person').person diff --git a/test/unit/recent_documents_block_test.rb b/test/unit/recent_documents_block_test.rb index c96366d..5835c63 100644 --- a/test/unit/recent_documents_block_test.rb +++ b/test/unit/recent_documents_block_test.rb @@ -84,7 +84,7 @@ class RecentDocumentsBlockTest < ActiveSupport::TestCase end should 'be able to update display setting' do - assert @block.update_attributes!(:display => 'always') + assert @block.update!(:display => 'always') @block.reload assert_equal 'always', @block.display end diff --git a/test/unit/rss_feed_test.rb b/test/unit/rss_feed_test.rb index 38c9cdf..b89b339 100644 --- a/test/unit/rss_feed_test.rb +++ b/test/unit/rss_feed_test.rb @@ -255,7 +255,7 @@ class RssFeedTest < ActiveSupport::TestCase should 'include only posts from some language' do profile = create_user('testuser').person blog = create(Blog, :name => 'blog-test', :profile => profile) - blog.feed.update_attributes! :language => 'es' + blog.feed.update! :language => 'es' blog.posts << en_post = fast_create(TextArticle, :name => "English", :profile_id => profile.id, :parent_id => blog.id, :published => true, :language => 'en') blog.posts << es_post = fast_create(TextArticle, :name => "Spanish", :profile_id => profile.id, :parent_id => blog.id, :published => true, :language => 'es') diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb index cd8eec8..5ddf150 100644 --- a/test/unit/user_test.rb +++ b/test/unit/user_test.rb @@ -43,12 +43,12 @@ class UserTest < ActiveSupport::TestCase end def test_should_reset_password - users(:johndoe).update_attributes(:password => 'new password', :password_confirmation => 'new password') + users(:johndoe).update(:password => 'new password', :password_confirmation => 'new password') assert_equal users(:johndoe), User.authenticate('johndoe', 'new password') end def test_should_not_rehash_password - users(:johndoe).update_attributes(:login => 'johndoe2') + users(:johndoe).update(:login => 'johndoe2') assert_equal users(:johndoe), User.authenticate('johndoe2', 'test') end diff --git a/vendor/plugins/action_tracker/lib/action_tracker_model.rb b/vendor/plugins/action_tracker/lib/action_tracker_model.rb index a7ef6d8..24dd818 100644 --- a/vendor/plugins/action_tracker/lib/action_tracker_model.rb +++ b/vendor/plugins/action_tracker/lib/action_tracker_model.rb @@ -37,7 +37,7 @@ module ActionTracker target_hash = params[:target].nil? ? {} : {:target_type => params[:target].class.base_class.to_s, :target_id => params[:target].id} conditions = { :user_id => u.id, :user_type => u.class.base_class.to_s, :verb => params[:verb].to_s }.merge(target_hash) l = where(conditions).last - ( !l.nil? and Time.now - l.updated_at < ActionTrackerConfig.timeout ) ? l.update_attributes(params.merge({ :updated_at => Time.now })) : l = new(params) + ( !l.nil? and Time.now - l.updated_at < ActionTrackerConfig.timeout ) ? l.update(params.merge({ :updated_at => Time.now })) : l = new(params) l end @@ -48,7 +48,7 @@ module ActionTracker l = where({user_id: u.id, user_type: u.class.base_class.to_s, verb: params[:verb].to_s}.merge target_hash).last if !l.nil? and Time.now - l.created_at < ActionTrackerConfig.timeout params[:params].clone.each { |key, value| params[:params][key] = l.params[key].clone.push(value) } - l.update_attributes params + l.update params else params[:params].clone.each { |key, value| params[:params][key] = [value] } l = new params diff --git a/vendor/plugins/kandadaboggu-vote_fu/examples/voteables_controller.rb b/vendor/plugins/kandadaboggu-vote_fu/examples/voteables_controller.rb index 71dadd7..d5e633d 100644 --- a/vendor/plugins/kandadaboggu-vote_fu/examples/voteables_controller.rb +++ b/vendor/plugins/kandadaboggu-vote_fu/examples/voteables_controller.rb @@ -42,7 +42,7 @@ class VoteablesController < ApplicationController end # GET /users/:id/voteables/1/edit - def edit + def edit @voteable ||= Voteable.find(params[:id]) end @@ -51,7 +51,7 @@ class VoteablesController < ApplicationController def create @voteable = Voteable.new(params[:voteable]) @voteable.user = current_user - + respond_to do |format| if @voteable.save flash[:notice] = 'Voteable was successfully saved.' @@ -68,9 +68,9 @@ class VoteablesController < ApplicationController # PUT /users/:id/voteable/1.xml def update @voteable = Voteable.find(params[:id]) - + respond_to do |format| - if @quote.update_attributes(params[:voteable]) + if @quote.update(params[:voteable]) flash[:notice] = 'Voteable was successfully updated.' format.html { redirect_to([@user, @voteable]) } format.xml { head :ok } @@ -92,17 +92,17 @@ class VoteablesController < ApplicationController format.xml { head :ok } end end - + private - def find_user + def find_user @user = User.find(params[:user_id]) end - + def must_own_voteable @voteable ||= Voteable.find(params[:id]) @voteable.user == current_user || ownership_violation end - + def ownership_violation respond_to do |format| flash[:notice] = 'You cannot edit or delete voteable that you do not own!' @@ -111,7 +111,7 @@ class VoteablesController < ApplicationController end end end - - - + + + end diff --git a/vendor/plugins/kandadaboggu-vote_fu/lib/controllers/votes_controller.rb b/vendor/plugins/kandadaboggu-vote_fu/lib/controllers/votes_controller.rb index 706f5cf..a9da6d5 100644 --- a/vendor/plugins/kandadaboggu-vote_fu/lib/controllers/votes_controller.rb +++ b/vendor/plugins/kandadaboggu-vote_fu/lib/controllers/votes_controller.rb @@ -1,9 +1,9 @@ class VotesController < ApplicationController # First, figure out our nested scope. User or vote? # before_filter :find_my_scope - + # before_filter :find_user - + # before_filter :login_required, :only => [:new, :edit, :destroy, :create, :update] # before_filter :must_own_vote, :only => [:edit, :destroy, :update] @@ -70,7 +70,7 @@ class VotesController < ApplicationController @vote = Vote.find(params[:id]) respond_to do |format| - if @vote.update_attributes(params[:vote]) + if @vote.update(params[:vote]) flash[:notice] = 'Vote was successfully updated.' format.html { redirect_to([@user, @vote]) } format.xml { head :ok } -- libgit2 0.21.2