instance method
reselect
Ruby on Rails 6.0.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 295
def reselect(*args)
check_if_method_has_arguments!(:reselect, args)
spawn.reselect!(*args)
end
Defined in activerecord/lib/active_record/relation/query_methods.rb line 295
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::QueryMethods