from

from(value, subquery_name = nil)
Instance Public methods

Specifies table from which the records will be fetched. For example:

1
2
Topic.select('title').from('posts')
# => SELECT title FROM posts

Can accept other relation objects. For example:

1
2
3
4
5
Topic.select('title').from(Topic.approved)
# => SELECT title FROM (SELECT * FROM topics WHERE approved = 't') subquery
 
Topic.select('a.title').from(Topic.approved, :a)
# => SELECT a.title FROM (SELECT * FROM topics WHERE approved = 't') a
doc_ruby_on_rails
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.