ruby-on-railsruby-on-rails-4ruby-grapegrape-apigrape-entity

Grape 'text' type parameter


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.


Solution

  • 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.