Ruby on Rails API with Vue.js - Adding Sample Data - 04

  Рет қаралды 8,247

webcrunch

webcrunch

Күн бұрын

Пікірлер
@DanielWentsch
@DanielWentsch 5 жыл бұрын
Thanks for this series, I really enjoy looking into Rails Quick note on a small issue I had in this chapter: The Artists table was created with null: false on the user_id reference. The following migration changes it to accept empty user references. Otherwise it wouldn't work to add Artists via the Rails console as shown. Good thing: I found out how to generate and write simple custom migrations :) If somebody else stumbled across this, here's the migration: ``` class MakeArtistUserIdOptional < ActiveRecord::Migration[6.0] def change change_column_null(:artists, :user_id, true) end end ```
@Webcrunch
@Webcrunch 5 жыл бұрын
Great catch. The null:false requirement is new to Rails 6. You could indeed run that migration. I believe you could add an "optional: true" setting within your Artist model. class Artist < ApplicationRecord belongs_to :user, optional: true end ^^ untested code! :)
@davidjforer
@davidjforer 4 жыл бұрын
lifesaver, LOL, thank you
@mariochaconc
@mariochaconc 4 жыл бұрын
Hi, I am following this tutorial (a bit late in time) and I came across the same error. I understand the cause of it but I am kind of new in programming and I can't really understand the solution. I have two questions: - This migration in your comment above has to replace the original migration (CREATE_ARTIST) or is one plus? - To run this migration how would you scaffold it? Thanks in advance
@glencorreia5318
@glencorreia5318 4 жыл бұрын
@@mariochaconc you'll have to run the following command: $rails g migration MakeArtistUserIdOptional Then add the contents in the generated file as shown in the comment by Daniel.
@mariochaconc
@mariochaconc 4 жыл бұрын
@@glencorreia5318 Yeah, it worked! Thanks
@xspaniki
@xspaniki 4 жыл бұрын
this guy deserve more subs! great work
@mihir-kumar-thakur
@mihir-kumar-thakur 5 жыл бұрын
Thank you for this awesome tutorial series. Loved this
@NeonNijahn
@NeonNijahn 10 ай бұрын
I keep getting a not null error when i use the Artist.create(name: "ACDC") function in the rails concole. It says the user id is nil initially but then says not null exception user id sqlite3
@oluwabukolatina6445
@oluwabukolatina6445 5 жыл бұрын
is there a reason why your soundtrack is so loud?
@renzodiaz8366
@renzodiaz8366 5 жыл бұрын
I followed step by step and I implemented with React which works ok unless the session expires when the session expires and you try to logout or create a record it throws 500 error and in the response header return "Unauthorized", seems to fails when try to refresh the token. I couldn't find a solution for it so I would be more than happy if someone had the same issue and got fix it.
@the_jacob_alexander
@the_jacob_alexander 5 жыл бұрын
Why you are using jwt_sessions gem, what the pros? Jwt implementation is super easy but in my opinion no with this gem.
Sigma Kid Mistake #funny #sigma
00:17
CRAZY GREAPA
Рет қаралды 30 МЛН
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 36 МЛН
Ruby on Rails API with Vue.js - JWTSessions Gem Setup - 03
25:25
Vue CRUD App With A Ruby On Rails 7 API Tutorial
22:17
Deanin
Рет қаралды 9 М.
Ruby on Rails API with Vue.js - Configuring Rails - 02
22:52
webcrunch
Рет қаралды 22 М.
Understanding Active Record Associations
15:16
webcrunch
Рет қаралды 35 М.
Vue and Axios (feat. Kanye REST API)
7:22
LearnVue
Рет қаралды 22 М.
A Tour of Stimulus.js
25:34
webcrunch
Рет қаралды 10 М.
Understanding Ruby on Rails ActiveRecord Validations
11:03
webcrunch
Рет қаралды 8 М.
#3- Vue Router 4:  Params & Queries
12:40
Chris Dixon
Рет қаралды 10 М.
Sigma Kid Mistake #funny #sigma
00:17
CRAZY GREAPA
Рет қаралды 30 МЛН