Commit 2aea3f191a852dd69329046dfd5bcbda20c6a843

Authored by Pius Uzamere
1 parent 635d0638

skipping works

Showing 1 changed file with 7 additions and 5 deletions   Show diff stats
app/controllers/prompts_controller.rb
... ... @@ -93,17 +93,19 @@ class PromptsController < InheritedResources::Base
93 93  
94 94  
95 95 def skip
96   - voter = User.auto_create_user_object_from_sid(params['params']['auto'])
97   - logger.info "#{voter.inspect} is skipping."
  96 + authenticate
  97 + logger.info "#{current_user.inspect} is skipping."
98 98 @question = Question.find(params[:question_id])
99 99 @prompt = @question.prompts.find(params[:id])
  100 +
  101 +
100 102 respond_to do |format|
101   - if @skip = voter.skip(@prompt)
  103 + if @skip = current_user.record_skip(params['params']['auto'], @prompt)
102 104 format.xml { render :xml => @question.picked_prompt.to_xml(:methods => [:left_choice_text, :right_choice_text]), :status => :ok }
103 105 format.json { render :json => @question.picked_prompt.to_json, :status => :ok }
104 106 else
105   - format.xml { render :xml => c, :status => :unprocessable_entity }
106   - format.json { render :json => c, :status => :unprocessable_entity }
  107 + format.xml { render :xml => @skip, :status => :unprocessable_entity }
  108 + format.json { render :json => @skip, :status => :unprocessable_entity }
107 109 end
108 110 end
109 111 end
... ...