ruby-grape / grape-entity

An API focused facade that sits on top of an object model.
MIT License
721 stars 153 forks source link

Adding default value to expose #327

Open rahul404 opened 4 years ago

rahul404 commented 4 years ago

Is there a way to add a default value to expose in case of the value is not present? For example

expose :tags do |filter|
  filter[:tags].present? ? filter[:tags] : "all"
end

could be replaced by expose :tags, default: "all"