title: Include user data in different controller
body: <p>I'm trying to render an activity list in the form of json so I can use that data in my AngularJS app. This is my activities controller:</p>
  
  <pre><code>def index
    @activities = PublicActivity::Activity.order("created_at desc")
    respond_to do |format|
      format.json do
        render :json =&gt; @activities.to_json()
      end
    end
  end
  </code></pre>
  
  <p>And it renders the json like this:</p>
  
  <pre><code>{"id":3,"trackable_id":6,"trackable_type":"Movie","owner_id":1,"owner_type":"User","key":"movie.create","parameters":{},"recipient_id":null,"recipient_type":null,"created_at":"2015-12-30T12:31:24.765Z","updated_at":"2015-12-30T12:31:24.765Z"},
  {"id":2,"trackable_id":5,"trackable_type":"Movie","owner_id":1,"owner_type":"User","key":"movie.create","parameters":{},"recipient_id":null,"recipient_type":null,"created_at":"2015-12-30T11:55:06.766Z","updated_at":"2015-12-30T11:55:06.766Z"},
  </code></pre>
  
  <p>As you can see there is a value called <code>owner_id</code>. This coincides with the <code>user id</code> of the user that did the activity.</p>
  
  <p>I of course have a user model with name, email etc. values. So for the first user with the id 1 it looks like this,</p>
  
  <pre><code>{"id":1,"email":"john@doe.nl","name":"John Doe"},
  </code></pre>
  
  <p>Is it possible to check the <code>owner_id</code> in the activities and find the <code>user_id</code> that coincides, and then add the name, email, etc. value to the activity controller?</p>
  
  <p>The result would be a json render like this:</p>
  
  <pre><code>{"id":3,"trackable_id":6,"trackable_type":"Movie","owner_id":1,"email":"john@doe.nl","name":"John Doe","owner_type":"User","key":"movie.create","parameters":{},"recipient_id":null,"recipient_type":null,"created_at":"2015-12-30T12:31:24.765Z","updated_at":"2015-12-30T12:31:24.765Z"},
  {"id":2,"trackable_id":5,"trackable_type":"Movie","owner_id":1,"email":"john@doe.nl","name":"John Doe","owner_type":"User","key":"movie.create","parameters":{},"recipient_id":null,"recipient_type":null,"created_at":"2015-12-30T11:55:06.766Z","updated_at":"2015-12-30T11:55:06.766Z"},
  </code></pre>