A
A
artem_music2016-05-24 16:42:22
MySQL
artem_music, 2016-05-24 16:42:22

How to make a request in Rails for a selection of materials that have a lot of text?

There is a model that has a text field. How to correctly get all models for which this field contains more text than, for example, 100 characters?
I imagine it something like this (but it's wrong):
$reviews = Review.where(text > 100).all

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Radushevsky, 2016-05-24
@artem_music

something like this
dev.mysql.com/doc/refman/5.7/en/string-functions.h...
$reviews = Review.where("LENGTH(text) > 100").all

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question