New Discussion

Notifications

You’re not receiving notifications from this thread.

Any way to reduce complexity passing JSON to Vue.js component?

0
Rails

Hi,
I'm trying to figure out a way to reduce the complexity of passing a JSON to a Vue.js component.
Currently I've got something like this placed on a model scope,

  scope :to_vue, -> (id) {where(team_id: id).order(position: :asc).to_json(
      only: [:id, :name, :position, :team_id], include: {
          postits: {
              include: [:user, comments: {
                  include: :actor
              }]
          }
      }
  )}

Anyone know a better way to create a Json format without all that amount of includes?

Thanks for your answers.

Join the discussion
Create an account Log in

Learning Ruby on Rails? Join our newsletter.

We won't send you spam. Unsubscribe at any time.