G
G
German Jet2017-08-01 18:32:07
Ruby on Rails
German Jet, 2017-08-01 18:32:07

Why does Rails complain about respond_to do |format|?

Welcome all.

def from_department
    @selected = Employee.where(:department_id => params[:department_id])
    respond_to do |format|
        format.js
    end
end
An error appears ActionController:: UnknownFormat
In config/initializers/mime_types.rbadded a line What could be the reason? Mime::Type.register "application/javascript", :js

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Demidenko, 2017-08-01
@Dem1

The reason is that you are sending a request not in js format

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question