ruby on rails - ActionController::UnknownFormat respond_with using Backbone.js -
I am trying to get data in my archive, but I get an unknown format error in the rail. I have been following the railcast to know about the spinal cord.
I am on the part where we are providing data in a view through the archive, but when I use the example code unknown format error
This is my Rail Films Controller
ClassroomController class & lt; ApplicationController response_to: response to json dff index_in if movie.all? @user = User.find (session [: user_id]) @ movies = @ user.movies End End
This is my Rail Router file,
Rails.application.routes.draw 'session / new' root 'movies # index' get 'signup' = & gt; get receive. 'User #' Get New 'Login' = & gt; 'Session # new' post 'login' = & gt; 'Create session' to delete 'logout' = & gt; 'Session # deleted' scope "API" do the resources: movies ,: fault = & gt; {: Format = & gt; "JSON"} End Resource: User
And this is my backbone collection
class Movieseat.Collections.Movieseats increases the Backbone.Collection url: / Api / movies'
I have done some research and have found that many people say that I ,: defaults = & gt; {: Format = & gt; "Json"}
In my film resource but it has not helped me Do anyone know what is the reason for this error?
I have problems today I have two potential improvements for this ...
1) Just answer the sentence-sentence, remove it with syntax and replace it with the render Jason
syntax:
Class Films Controller & lt ; ApplicationController def index @movies = Movie.all if log in_in? @ User = user.fid (session [: user_id]) @ mvs = @ user Amovis and Render Jason: @ Films.t_json and end
I think it can not be ideal, but what is it for me?
2) It I have not tried, but it may be worth a try (can not be used with the first solution).
Anywhere in your spinal setup:
$ AjaxSetup ({dataType: 'json'});
Comments
Post a Comment