bellycard / napa

A simple framework for building APIs with Grape
Other
329 stars 72 forks source link

Add hashie rails to prevent ActiveModel ForbiddenAttributeError #192

Closed smedrick closed 9 years ago

smedrick commented 9 years ago

This is an issue with grape, and it looks like it was closed without fixing: https://github.com/intridea/grape/issues/404#issuecomment-47172686

shaqq commented 9 years ago

How are you getting that error currently? I can't seem to reproduce it.

smedrick commented 9 years ago

I set up a new app and put together the people-service example in the Quickstart guide. When I attempt to POST json to the endpoint, it returns ActiveModel::ForbiddenAttributesError: ActiveModel::ForbiddenAttributesError on the Person.create! mass-assign call.

As soon as I included hashie_rails, it started working.

shaqq commented 9 years ago

@smedrick apologies for the late response. I'm assuming your version of Grape is 0.11.0 after following the Napa instructions?

The quickest solution is probably to lock Grape at a certain version in Napa. We haven't done the best job of locking gem versions, so we have to start doing that anyway.

smedrick commented 9 years ago

@shaqq Yeah, looks like I'm running 0.11.0. I haven't had any other glaring issues since including the hashie_rails gem, FWIW. Locking the Grape version is probably the safer solution.