I've found a strange (to me) response from rails if I try to render
output as json, whereas xml is fine. From the logs. For example, here
are the logs for a simple query (from the browser) to list all "jobs":
Started GET "/jobs.json" for 127.0.0.1 at 2011-01-05 16:44:45 +0000
Processing by JobsController#index as JSON
Completed 406 Not Acceptable in 11ms
Started GET "/jobs.xml" for 127.0.0.1 at 2011-01-05 16:48:11 +0000
Processing by JobsController#index as XML
Completed 200 OK in 13ms (Views: 1.9ms)
The code being called is much the same:
def index
@jobs = Job.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @jobs }
format.json { render :json => @jobs }
end
end
Is this some dreadful misunderstanding on my part as to how rails 3
works, or is something else at work here?
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.