Skip to content

Conversation

jamespearson
Copy link
Contributor

Previously matches_regex was only available on PostgreSQL, this will enable it for MySql

Usage example:

    users = User.arel_table;

    # Find all gmail users
    users = User.arel_table; User.where(users[:email].matches_regexp('(.*)\@gmail.com'))

    # Find all none gmail users
    users = User.arel_table; User.where(users[:email].does_not_match_regexp('(.*)\@gmail.com'))

@jamespearson jamespearson force-pushed the matches_regex_mysql branch 3 times, most recently from 3a62a4d to 4ebb9fe Compare July 29, 2019 11:35
Copy link
Member

@kamipo kamipo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Can you squash commits into one?

Previously matches_regex was only availble on PostgreSql, this will enable it for MySql

Usage example:

    users = User.arel_table;
    users = User.arel_table; User.where(users[:email].matches_regexp('(.*)\@gmail.com'))

Update activerecord/test/cases/arel/visitors/mysql_test.rb

Co-Authored-By: Ryuta Kamizono <kamipo@gmail.com>
@jamespearson jamespearson force-pushed the matches_regex_mysql branch from fda8cf6 to 92c265b Compare July 29, 2019 14:54
@jamespearson
Copy link
Contributor Author

@kamipo - Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants