title: Rails render jbuilder in action
body: <p>I want to push to websockets what normally would be returned from a jbuilder view when the route is called but I cannot call render twice in an action:</p>
  
  <pre><code>def
    ...
  
    @resource_receivers = "#{@resource.model_name.singular.capitalize}Receiver".constantize.where("#{@resource.model_name.singular}_id": @resource)
    @resource_receivers.each do |resource_receiver|
      resource_receiver.create_activity :sent, owner: @current_user, recipient: resource_receiver.receiver
    end
  
    to_return = render 'api/received/show'
  
    Pusher.trigger('resources', 'resource.received', JSON.parse(to_return.first))
  
    return render :task
  end
  </code></pre>
  
  <p>How would I solve this? Or in general, I'd like to return what normally would be returned from the jbuilder anywhere else in my application, for example if I wanted to refactor this to have a method that pushes to the user</p>