[Vuejs]-Rails: Is it possible to assign PostgreSQL database entries to Vue in Rails?

0👍

It’s of course possible. The rough logic is that you’re de-coupling the front-end from the back-end, and as such you can access back-end (Rails) from the front-end (Vue) with routes.

mounted: function() {
  this.$http.get(`/api/v1/items`) // or whatever
    .then(response => {
      this.items = response.body.items
  })
}

As long as your controller renders your items correctly it’ll work. Obviously things like authentication can be applied to this kinda logic.

Leave a comment