This project is archived and is in readonly mode.
Problem executing simple model#to_json
-
David Trasbo
- Assigned user set to Ryan Bigg
I was unable to duplicate this issue on
master:➜ ticket_4015 script/rails g model user name:string ➜ ticket_4015 rake db:migrate (in /Users/dtrasbo/code/rails/railties/tmp/ticket_4015) ➜ ticket_4015 script/rails g controller users index ➜ ticket_4015 script/rails c Loading development environment (Rails 3.0.0.beta4) ruby-1.9.2-preview3 > User.create(:name => 'David Trasbo') => #<User id: 1, name: "John Smith", ...> ruby-1.9.2-preview3 > User.create(:name => 'Marc Hejner') => #<User id: 2, name: "David Trasbo", ...>class UsersController < ApplicationController def index @users = User.all respond_to do |format| format.json { render :json => @users.to_json(:only => :name) } end end endResponse body for
http://localhost:3000/users.json:[{"user":{"name":"John Smith"}},{"user":{"name":"David Trasbo"}}]This ticket can be closed.
-
David Trasbo
Gah, you'll probably notice I tried to change some names above, but looked over a couple of places.
-
Rohit Arondekar
- State changed from new to invalid
- Importance changed from to Low
