Grape 'text' type parameter

608 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 answers

0
Roshan 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.