KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Currently I build a JSON object by doing: @users = User.all @users.each do |user| @userlist << { :id => user.id, :fname => user.fname, :lname => user.lname, :photo => user.profile_pic.url(:small) } end My challenge is I now want to include records from the @contacts table that have a different set of fields than the User model. I tried doing @users = User.all @contacts = current_user.contacts @users << @contacts But that did not work. What's the best way to combine two similar models into one JSON object?
Tags (comma-separated)
Save Edits
Cancel