Skip to content

Instantly share code, notes, and snippets.

@torsday
Created November 24, 2014 19:29
Show Gist options
  • Save torsday/8a6e0fc188fb72ee3128 to your computer and use it in GitHub Desktop.
Save torsday/8a6e0fc188fb72ee3128 to your computer and use it in GitHub Desktop.
tci_82865566.rb
class Shared::AnswersController < ApplicationController
before_filter :authenticate_student_or_teacher!
def create
@lesson = Lesson.where(id: params[:lesson_id]).first
authorize! :read, @lesson
@challenge = @lesson.challenge
@challenge_result = current_student ? @challenge.result_for_student(current_student) : @challenge.result_for_staffer(current_staffer)
@max_num_attempts = false
challenge_answer(params[:question_id], params[:answer_id])
respond_to do |format|
format.js
format.html
end
end
@torsday
Copy link
Author

torsday commented Nov 24, 2014

I added line 14's format.html in an attempt to remedy the UnknownFormat error seen in new relic, under the assumption is that it's unintentionally looking for the default html response. If this fixes it, the deeper issue, per this SO article implies we're likely calling for an html response other than js. If it doesn't fix it, it likely means we're calling for a different response (perhaps json). Either way, my question is... How best to track down where this is getting called? app/views/shared/answers/_attempt.js.erb is where I'm looking, but nothing stands out as an improper request.

@torsday
Copy link
Author

torsday commented Nov 24, 2014

Of the two places the @answer_path (defined as shared_program_lesson_challenge_answers_path(@program, @lesson)) are used, both use :remote => true.

Sounds like it could be an assets thing.

@torsday
Copy link
Author

torsday commented Nov 24, 2014

Checked the source code of view-source:http://demo.teachtci.com/shared/programs/156/lessons/1474/challenge, all the remote's properly show up within their tags as true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment