Skip to main content
Ask A Question
Notifications
You’re not receiving notifications from this thread.
Subscribe

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

Rails • Asked by Eduard Garcia

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.


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 29,763+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.