Michael Burke

Joined

230 Experience
2 Lessons Completed
0 Questions Solved

Activity

nevermind. I see how it works. If env['warden'].user is nil, then the whole statement is nil which points you to the else. if env['warden'].user is not nil, then the if statement is true and current_user gets assigned to warden user.

I have the same question. It doesn't validate if I use "==", which I don't understand

Posted in Introduction to Importing from CSV Discussion

Hey Chris -

You mentioned that User.create without the ! will allow an attempt to save to the db to fail silently if the record already exists, but isn't that only true if you've created a uniqueness constraint on the User model? That's the only way I could make it work. Using postgres.

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2020 GoRails, LLC. All rights reserved.