0

Very new to angular on rails. Basic app idea is to let anyone view venues. Click on venues. Make comments. At the moment I have a single model: venue. Hard-coded data. Full crud. Renders as JSON. Basically I want nested resources. Comments are not useful except in the context of the venue they belong to. I'm trying to find information about how I should create associations in rails api. Like does the venue have many comments such that active record knows about it? Or do I just pass comments as a hash attribute to the single venue model, and if so, how?

3
  • 1
    Use ActiveSerializers.. You can override attributes data structures in any format and can easily use nested attributes Commented Aug 20, 2016 at 20:22
  • Thanks. ActiveSerializers worked well! Commented Aug 21, 2016 at 21:02
  • Can you please upvote for the below answer i had suggested? thanks! Commented Aug 24, 2016 at 11:35

1 Answer 1

1

Use ActiveModelSerializers. You can override attributes data structures in any format and can easily use nested resources.https://github.com/rails-api/active_model_serializers

Sign up to request clarification or add additional context in comments.

1 Comment

@mfournier91 I understand my answer helped you, Can you please upvote for the above answer i had suggested? thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.