lundi 7 octobre 2019

What is the use of ! in rails

What is the use of ! in rails?

Especially in this line: From HArtl tutorial

users = User.order(:created_at).take(6)
50.times do 
    content = Faker::Lorem.sentence(5)
    user.each { |user| user.microposts.create!( content: content )}
end

Basically this is creating tweets/microposts for 6 users.

I am really wondering why need to use !

Aucun commentaire:

Enregistrer un commentaire