From 1d4ab5abc754d9245b234d47046dcd0e24e5bc9e Mon Sep 17 00:00:00 2001 From: Dmitri Garbuzov Date: Mon, 28 Jun 2010 16:38:37 -0400 Subject: [PATCH] Removed set_autoactivate_ideas_from_abroad --- app/controllers/questions_controller.rb | 30 +++++++----------------------- config/routes.rb | 1 - spec/controllers/questions_controller_spec.rb | 8 -------- 3 files changed, 7 insertions(+), 32 deletions(-) diff --git a/app/controllers/questions_controller.rb b/app/controllers/questions_controller.rb index 3e1eadd..ea451d9 100644 --- a/app/controllers/questions_controller.rb +++ b/app/controllers/questions_controller.rb @@ -94,29 +94,6 @@ class QuestionsController < InheritedResources::Base end end - - - def set_autoactivate_ideas_from_abroad - #expire_page :action => :index - logger.info("INSIDE autoactivate ideas") - - - @question = current_user.questions.find(params[:id]) - @question.it_should_autoactivate_ideas = params[:question][:it_should_autoactivate_ideas] - - respond_to do |format| - if @question.save - logger.info "successfully set this question to autoactive ideas #{@question.inspect}" - format.xml { render :xml => true } - format.json { render :json => true} - else - logger.info "Some error in saving question, #{@question.inspect}" - format.xml { render(:xml => false) and return} - format.json { render :json => false } - end - end - - end def export type = params[:type] response_type = params[:response_type] @@ -314,6 +291,13 @@ class QuestionsController < InheritedResources::Base end end + def update + # prevent AttributeNotFound error and only update actual Question columns, since we add extra information in 'show' method + question_attributes = Question.new.attribute_names + params[:question] = params[:question].delete_if {|key, value| !question_attributes.include?(key)} + update! + end + protected end diff --git a/config/routes.rb b/config/routes.rb index 279acc9..f506fbd 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -5,7 +5,6 @@ ActionController::Routing::Routes.draw do |map| map.resources :questions, :member => { :object_info_totals_by_date => :get, :object_info_by_visitor_id => :get, :export => :post, - :set_autoactivate_ideas_from_abroad => :put, :activate => :put, :suspend => :put}, :collection => {:all_num_votes_by_visitor_id => :get, diff --git a/spec/controllers/questions_controller_spec.rb b/spec/controllers/questions_controller_spec.rb index 179a741..d850d82 100644 --- a/spec/controllers/questions_controller_spec.rb +++ b/spec/controllers/questions_controller_spec.rb @@ -33,12 +33,4 @@ describe QuestionsController do @response.body.should have_tag("visitor_ideas") end - - it "can be set to autoactivate questions" do - put :set_autoactivate_ideas_from_abroad, :id => @question.id, :format => "xml", :question => {:it_should_autoactivate_ideas => true} - assigns[:question].should == @question - assigns[:question].it_should_autoactivate_ideas.should be_true - @response.body.should == "true" - end - end -- libgit2 0.21.2