I have a custom model "Result" as shown below where in its attributes groups and categories are active-record models having id, created_at, updated_at.
class Result
attr_accessor :groups, :categories
end
when to_json is invoked on Result object with :except[:id, :created_at, :updated_at] method on groups and categories, there is no effect, the JSON output constructed contains id, created_at and updated_at.
Please help me out in constructing the proper conditional to_json to get JSON output without id, created_at, updated_at on groups and categories.
Example:
result = Result.new
result.groups = groups
result.categories = categories
result.to_json(:include => {
:groups => {:except => [:id, :created_at, :updated_at]},
:categories => {:except => [:id, :created_at, :updated_at]}
})