respond_with returns unknown format - rails

Viewed 6086

I am using through AngularJS to send some json, in the controller I have

respond_to :json

def create
    respond_with Task.create(description: params[:description])
end

the tasks is stored on the database, but then I get this message in my log

ActionController::UnknownFormat - ActionController::UnknownFormat:
  (gem) actionpack-4.0.0/lib/action_controller/metal/mime_responds.rb:372:in `retrieve_collector_from_mimes'
  (gem) actionpack-4.0.0/lib/action_controller/metal/mime_responds.rb:327:in `respond_with'

...

I tried to add in my route resources :tasks, :defaults => {:format => "js"}. How can I handle this problem ?

1 Answers
Related