method
reselect
v8.1.1 -
Show latest stable
- 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.