Reputation: 1073
There is the following condition in Ruby:
before_create do
self.name = login.capitalize if name.blank?
end
Does it mean that variable self.name
will take login
field with capitalized text only when field name
is not empty?
Upvotes: 0
Views: 43
Reputation: 3723
Right the opposite. self.name
will receive the value of login.capitalize
when name.blank?
is true
.
You may read this condition exactly as if it were written in the 'traditional way`, like:
if name.empty? then
self.name = login.capitalize
end
Upvotes: 1