I want to use find_or_create_by, but this statement does NOT work. It does not \"find\" or \"create\" with the other attributes.
productproperty = ProductPro
In Rails 4, you can use find_or_create_by(attr1: 1, attr2: 2) to find or create by multiple attributes.
You can also do something like:
User.create_with(
password: 'secret',
password_confirmation: 'secret',
confirmation_date: DateTime.now
).find_or_create_by(
email: 'admin@domain.com',
admin: true
)
If you need to create the user with some attributes, but cannot search by those attributes.