method

reselect

Importance_1
v6.1.7.7 - Show latest stable - 0 notes - Class: ActiveRecord::QueryMethods
reselect(*args) public

Allows you to change a previously set select statement.

Post.select(:title, :body)
# SELECT `posts`.`title`, `posts`.`body` FROM `posts`

Post.select(:title, :body).reselect(:created_at)
# SELECT `posts`.`created_at` FROM `posts`

This is short-hand for unscope(:select).select(fields). Note that we’re unscoping the entire select statement.

Show source
Register or log in to add new notes.