Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Antonio Falcetta
Antonio Falcetta
14,192 Points

Updating records from .json (REST) files

Hello,

How can I update multiple records (without calling the single id) with the "update" method from json source?


PUT / PATCH / contacts
Content-Type: application / json
[
     {
         "FirstName": "my first name (1)",
         "LastName": "my last name (1)"
         (...)
     },
     {
         "FirstName": "my first name (2)",
         "LastName": "my last name (2)"
         (...)
     },
     (...)
]


Thank you
Ari Misha
Ari Misha
19,323 Points

Hiya there! Use Markdown Cheatsheet to wrap your code in order for programmers to understand the code. Cheatsheet link is right below in bold alphabets. Do that and then i might be able to understand whats going on (:

Ari Misha
Ari Misha
19,323 Points

Hiya! If you wont send ":id" , how'd rails suppose to know which entries it needs to update?

1 Answer

Antonio Falcetta
Antonio Falcetta
14,192 Points

I was thinking of .json fileI was thinking of .json file