Why is my controller action only returning in HTML format even when I explicitly state that it can only return as of type JS?
app/controllers/classrooms_controller.rb
def create
respond_to do |format|
format.js # This doesn't work.
end
end
app/views/classrooms/new.html.haml
= form_tag classrooms_path, :html => {:multipart => true}, do |f|
= text_field_tag :name
= submit_tag "Done"
app/views/classrooms/create.js.erb
alert('hi');
Server
Started POST "/classrooms" for 127.0.0.1 at 2013-01-04 18:17:22 -0800
Processing by ClassroomsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"Z+rsjO1rY2+P7VdsYd/LwiQr3DZX6r1/Dxh7JGbIOFA=", "name"=>"feed", "commit"=>"Done"}
Completed 406 Not Acceptable in 2ms
I get a blank page with no code (checked the source) in the browser.