Ruby on Rails Saturday, July 30, 2011

Actually, the user is outputted when accessing other resources, I can work with that :)


One issue, I want the user object to also show the user ID. Now it only shows the email and username. It renders the json like this:

[
  • -
    {
    • email: "email@example.com"
    • username: "Example"
    }
  • -
    [
    • -
      {
      • created_at: "2011-07-26T11:30:55Z"
      • id: 1
      • title: "Test"
      • updated_at: "2011-07-26T11:30:55Z"
      • user_id: 1
      }
    • -
      {
      • created_at: "2011-07-26T16:53:26Z"
      • id: 2
      • title: "Test2"
      • updated_at: "2011-07-26T16:53:26Z"
      • user_id: 1
      }
    ]
]


I can't use the user_id in the items because if the user don't have any items it would not be displayed.

Any tips?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/_P5-EDkGjj8J.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment