Skip to main content

Subscribe to GoRails to get access to this episode and all other pro episodes, and new awesome content every month.

Subscribe Now
Only $19/month

Unlimited access. Cancel anytime.

19 Rails & Vue.js Trello Clone - Part 2

Episode 218 · December 5, 2017

Adding new cards to our Vue app, persisting them in Rails, and re-rendering our UI

Javascript VueJS


Transcripts

Subscribe or login to view the transcript for this episode.

Discussion


Gravatar
Francisco Quinones (7,230 XP) on

Wow a lot to process nice. Will keep a eye on this as I like to move to more frontend stuff. Thank you Chris


Gravatar
geraldcarter08 on

I followed along step by step - but I am not getting the 200 status response. When I check your code on github, it looks like you've added quite a bit more than what was covered in the 2 videos. Everything is just null for me when I click the button. Any direction on where to troubleshoot that?


Gravatar
Dan Chap on

Hi Chris,

Any plans on creating some content on Vus.js Rails Steps forms?
I have a monster of a form I would like to use this for.

Dan


Gravatar
Pardha (3,110 XP) on

Hi Chris,

I had to set 'this' reference externally to use it in Success callback. But you didn't do that in the video I wonder how that works for you ? Please check the below code snippet SS . https://uploads.disquscdn.c...

Gravatar
Chris Oliver (159,840 XP) on

I used a thick arrow function which does that for you. You'll see my success function is: "success: (data) => {" and you use "success: function()".


Gravatar
Gustavo Parolin on

Hi Chris. I'm getting an error at 9:33, when I try to add a card.
```Uncaught ReferenceError: Rails is not defined at VueComponent.submitMessages (app.vue:31)```
Can you help me solving this?

Gravatar
Rui Freitas (30 XP) on
Hi Gustavo, I had the same problem... after comparing Chris' application.js file with my own, I noticed I was missing rails-ujs... This used to be a gem which has now been moved into Rails 5.1.

I was able to fixe Rails.ajax by updating my gemfile to run Rails 5.1 or above and by requiring rails-ujs in application.js

Gravatar
Rui Freitas (30 XP) on
Hi Chris, I'm getting a "Uncaught ReferenceError: Rails is not defined" error when trying to send ajax requests with "Rails.ajax"... I've never seen this type of syntax so I'm a bit lost as to where this is coming from.
Gravatar
Chris Oliver (159,840 XP) on
Make sure you're using rails-ujs and have it included in your asset pipeline. It was introduced in one of the newer versions of Rails to remove jQuery. If you're on an older version of Rails you can either upgrade or change the Rails.ajax to jQuery's version.

Login or create an account to join the conversation.