1 minute read
All of us would have used aliases with SQL queries as it makes the table
and column names more readable.
The renaming is just a temporary change
and the table name does not change in the original database.
Rails now support aliased attributes with insert_all
which means we can add aliases in the Active Record model.
here we are adding an alias name to
the original title attribute of Product
We can notice,
it throws an error
saying unknown attribute name.
Aliased attributes also work with upsert_all
As it can be seen,
it does not throw an error
while using aliased attributes with insert_all
Note: The enhancement is yet to be released in the official Rails version