Grape 'text' type parameter

624 Views Asked by At

I have a column type TEXT in my database. What type of parameter should I declare in my API?

params do
  requires :body, type: Text
end

The code above produces this error: uninitialized constant API::Articles::Text (NameError)

I tried setting the parameter as a type: String, but my test responded with an ArgumentError.

1

There are 1 best solutions below

0
On BEST ANSWER

Somehow API params doesn't accept column name body. This was the reason for the error. I managed to solve it by changing the attribute name.