I need to render JSON response for the REST api in which I need to include additional JSON fields that are not part of the model being rendered. I did read this [link](http://api.rubyonrails.org/classes/ActiveModel/Serializers/JSON.html "link") about ActiveModel where it suggests to use the ":methods" option to call another method where I can additional generic fields.

```
def add_fields
  { "field1" => "true" }
end

if @user.save
  render :json => @user.as_json(:only => [:username, :org], :methods => [:add_fields])
endif

```

However, when the JSON response is received only the username & org fields are returned in the JSON. The additional parameters defined in the method "add\_fields" are not added. What is it that I am missing due to which additional fields are not being added to JSON response. Or is there a better way to add generic fields (not part of model) in JSON response?