i have the following jbuilder class:
json.array!(@users) do |user|
json.user_id user.id
json.user_name user.full_name
...
end
But i want all @users data inside a :data attribute. And a code and a message for the response. Exactly like this:
{ :code => 200, :message => "Succesful request", :data => {[{user_id: 12, user_name: "Jason"},{user_id: 13, user_name: "Peter"}...]} }
How can i do it?
Thanks in advance.