Hello, everyone I want to get a tuple with a specific string from the rails.
When I do the sql door, LIKE '% specific string%' could be searched.
Rails has several functions that use db I'd like to know if there's a function.
ruby database ruby-on-rails
You can do it as below.
To use variables
@name = specific string
User.where("name like ?", "%" + @name + "%")
Or if you want to use it right away
User.where ("name like % specific string %")
© 2024 OneMinuteCode. All rights reserved.