instance method
reselect
Ruby on Rails 7.1.6
Since v6.0.6Signature
reselect(*args)
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.
Parameters
-
argsrest
Source
# File activerecord/lib/active_record/relation/query_methods.rb, line 480
def reselect(*args)
check_if_method_has_arguments!(__callee__, args)
args = process_select_args(args)
spawn.reselect!(*args)
end
Defined in activerecord/lib/active_record/relation/query_methods.rb line 480
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::QueryMethods