Ask A Question

Notifications

You’re not receiving notifications from this thread.

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

Eduard Garcia asked in 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.

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,329+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.