method

match?

Importance_1
v6.1.7.7 - Show latest stable - 0 notes - 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
Show source
Register or log in to add new notes.