Earlier conditions can either be specified as a string or array now in edge rails we can specify hash also. So if we specify conditions as hash then it will generate conditions based on equality with SQL AND.

Example:

will generate SQL as “where `first_name` = ‘akhil’ and `role` = ‘admin’”

Also we can have range as condition

Example:

will generate SQL as “where `access_level` BETWEEN 3 AND 5″

This is really helpful modification in ActiveRecord 🙂

Share this: