-
-
Save jiripospisil/92ef348b27f5ee6f4064 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[3] pry(#<UsersController>)> @user | |
=> #<User:0x007f1a899a1708 id: 3, name: "Bob", created_at: Thu, 08 Jan 2015 22:08:04 UTC +00:00, updated_at: Thu, 08 Jan 2015 22:08:04 UTC +00:00> | |
[4] pry(#<UsersController>)> render json: @user, only: ["id", "name"] | |
=> ["{\"id\":3,\"name\":\"Bob\"}"] | |
[5] pry(#<UsersController>)> self.response_body = nil | |
=> nil | |
[6] pry(#<UsersController>)> render json: @user, only: [:id, :name] | |
=> ["{\"id\":3,\"name\":\"Bob\"}"] | |
[7] pry(#<UsersController>)> Rails.version | |
=> "4.2.0" | |
[8] pry(#<UsersController>)> @user.to_json only: ["id", "name"] | |
=> "{\"id\":3,\"name\":\"Bob\"}" | |
[9] pry(#<UsersController>)> @user.to_json only: [:id, :name] | |
=> "{\"id\":3,\"name\":\"Bob\"}" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment