From 67100aa7bbf387a9c996f9399e8fe58130cfb1df Mon Sep 17 00:00:00 2001 From: Dan Hansen <mokker1234@gmail.com> Date: Sat, 22 Jan 2011 00:39:53 -0600 Subject: [PATCH] fix the build --- app/controllers/aspects_controller.rb | 15 +++++++-------- spec/controllers/aspects_controller_spec.rb | 4 ++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb index 79f2a8ab5a..2bec15c4a9 100644 --- a/app/controllers/aspects_controller.rb +++ b/app/controllers/aspects_controller.rb @@ -6,7 +6,7 @@ class AspectsController < ApplicationController before_filter :authenticate_user! respond_to :html - respond_to :json, :only => [:show, :move_contact] + respond_to :json, :only => :show respond_to :js def index @@ -113,21 +113,20 @@ class AspectsController < ApplicationController @from_aspect = current_user.aspects.where(:id => params[:from]).first @to_aspect = current_user.aspects.where(:id => params[:to][:to]).first - response = { } + response_hash = { } unless current_user.move_contact( @person, @to_aspect, @from_aspect) flash[:error] = I18n.t 'aspects.move_contact.error',:inspect => params.inspect end if aspect = current_user.aspects.where(:id => params[:to][:to]).first - response[:notice] = I18n.t 'aspects.move_contact.success' - response[:success] = true + response_hash[:notice] = I18n.t 'aspects.move_contact.success' + response_hash[:success] = true else - response[:notice] = I18n.t 'aspects.move_contact.failure' - response[:success] = false + response_hash[:notice] = I18n.t 'aspects.move_contact.failure' + response_hash[:success] = false end - - respond_with response + render :text => response_hash.to_json end def add_to_aspect diff --git a/spec/controllers/aspects_controller_spec.rb b/spec/controllers/aspects_controller_spec.rb index cd2c716187..56ca901764 100644 --- a/spec/controllers/aspects_controller_spec.rb +++ b/spec/controllers/aspects_controller_spec.rb @@ -210,13 +210,13 @@ describe AspectsController do :person_id => @person.id, :from => @aspect0.id, :to => - {:to => @aspect1.id} + {:to => @aspect1.id}, } end it 'calls the move_contact_method' do @controller.stub!(:current_user).and_return(@user) @user.should_receive(:move_contact) - post :move_contact, @opts + post "move_contact", @opts end end -- GitLab