The *
is a splat operator. So, take the following example.
[2] pry(main)> fields
=> ["first_name", "last_name"]
[3] pry(main)> User.first.attributes.values_at(fields)
User Load (0.5ms)SELECT`users`.* FROM `users` ORDER BY `users`.`id` ASC LIMIT 1
=> [nil]
[4] pry(main)> User.first.attributes.values_at(*fields)
User Load (0.5ms)SELECT`users`.* FROM `users` ORDER BY `users`.`id` ASC LIMIT 1
=> ["System", "Administrator"]
http://blog.honeybadger.io/rub...
The !
at the end of find_or_create_by
will raise an exception on validation errors.