method
match?
v7.1.3.2 -
Show latest stable
- Class:
ActiveModel::Name
match?public
Equivalent to String#match?. Match the class name against the given regexp. Returns true if there is a match, otherwise false.
class BlogPost extend ActiveModel::Naming end BlogPost.model_name.match?(/Post/) # => true BlogPost.model_name.match?(/\d/) # => false