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 ```
@Webcrunch5 жыл бұрын
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! :)
@davidjforer4 жыл бұрын
lifesaver, LOL, thank you
@mariochaconc4 жыл бұрын
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
@glencorreia53184 жыл бұрын
@@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.
@mariochaconc4 жыл бұрын
@@glencorreia5318 Yeah, it worked! Thanks
@xspaniki4 жыл бұрын
this guy deserve more subs! great work
@mihir-kumar-thakur5 жыл бұрын
Thank you for this awesome tutorial series. Loved this
@NeonNijahn10 ай бұрын
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
@oluwabukolatina64455 жыл бұрын
is there a reason why your soundtrack is so loud?
@renzodiaz83665 жыл бұрын
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_alexander5 жыл бұрын
Why you are using jwt_sessions gem, what the pros? Jwt implementation is super easy but in my opinion no with this gem.