206 results found for "{query"

cache_version

(ActiveRecord::Relation, >= v6.0.0 <= v7.1.3.4)
Importance_2_sm

query, and the timestamp of the last updated record. When a new record comes to match the query, or any of the existing records is updated or deleted, the cache version changes. If the collection is loaded, the method will iterate through the records to generate the timestamp, otherwise it will

ActiveRecord::Base

Importance_5_sm

querying. MultiparameterAssignmentErrors - Collection of errors that occurred during a mass assignment using the {ActiveRecord::Base#attributes=}[rdoc-ref:AttributeAssignment#attributes=] method. The errors property of this exception contains an array of AttributeAssignmentError objects that should be inspected to determine which attributes triggered the errors. RecordInvalid - raised by {ActiveRecord::Base#save

value

(ActiveRecord::Promise, >= v7.1.3.2 <= v7.1.3.4)
Importance_1_sm

Returns the query result. If the query wasn’t completed yet, accessing #value will block until the query completes. If the query failed, #value will raise the corresponding error.

ActiveRecord::Result

Importance_2_sm

Active Record Result This class encapsulates a result returned from calling {#exec_query}[rdoc-ref:ConnectionAdapters::DatabaseStatements#exec_query] on any database connection adapter. For example:

new

(ActiveRecord::Associations::Preloader, >= v3.1.0 <= v7.1.3.4)
Importance_2_sm

array of ActiveRecord::Base . The Preloader will try to use the objects in this array to preload the requested associations before querying the database. This can save database queries by reusing in-memory objects. The optimization is only applied to single associations (i.e. :belongs_to, :has_one) with no scopes.

ActiveRecord::DelegatedType

Importance_4_sm

neither are without their drawbacks. The problem with purely abstract classes is that all concrete subclasses must persist all the shared attributes themselves in their own tables (also known as class-table inheritance). This makes it hard to do queries across the hierarchy. For example, imagine you have the following hierarchy:

to_query

(Array, >= v3.0.0 <= v7.1.3.4)
Importance_1_sm

Converts an array into a string suitable for use as a URL query string, using the given key as the param name.

size

(ActiveRecord::Associations::CollectionProxy, >= v4.0.2 <= v7.1.3.4)
Importance_2_sm

collection hasn’t been loaded, it executes a SELECT COUNT(*) query. Else it calls collection. size . If the collection has been already loaded size and length are equivalent. If not and you are going to need the records anyway length will take one less query. Otherwise size is more efficient.

ActionController::Streaming

Importance_4_sm

queries are made, and the layout is processed. Streaming inverts the rendering flow by rendering the layout first and subsequently each part of the layout as they are processed. This allows the header of the HTML (which is usually in the layout) to be streamed back to client very quickly

exists?

(ActiveRecord::FinderMethods, >= v3.0.0 <= v7.1.3.4)
Importance_2_sm

query}%"]) . Hash - Finds the record that matches these where-style conditions (such as {name: 'David'} ). false - Returns always false . No args - Returns false if the relation is empty, true otherwise. For more information about specifying conditions as a hash or array, see the Conditions section in the introduction to ActiveRecord

update

(ActiveRecord::Persistence::ClassMethods, >= v5.2.3 <= v7.1.3.4)
Importance_2_sm

Updating a large number of records will run an UPDATE query for each record, which may cause a performance issue. When running callbacks is not needed for each record update, it is preferred to use {update_all}[rdoc-ref:Relation#update_all] for updating all records in a single query.

with_raw_connection

(ActiveRecord::ConnectionAdapters::AbstractAdapter, >= v7.1.3.2 <= v7.1.3.4)
Importance_2_sm

queries in subsequent calls.) If materialize_transactions is false, the block will be run without ensuring virtual transactions have been materialized in the DB server’s state. The active transaction will also remain clean (if it is not already dirty), meaning it’s able to be restored by reconnecting and opening

cacheable_query

(ActiveRecord::ConnectionAdapters::DatabaseStatements, >= v4.2.1 <= v7.1.3.4)
Importance_1_sm

This is used in the StatementCache object. It returns an object that can be used to query the database repeatedly.

none

(ActiveRecord::QueryMethods, >= v4.0.2 <= v7.1.3.4)
Importance_2_sm

array of records without querying the database. Any subsequent condition chained to the returned relation will continue generating an empty relation and will not fire any query to the database. Used in cases where a method or scope could return zero records but the result needs to be chainable. For example:

ActiveRecord::ExplainSubscriber

Importance_0_sm

SCHEMA queries cannot be EXPLAINed, also we do not want to run EXPLAIN on our own EXPLAINs no matter how loopingly beautiful that would be. On the other hand, we want to monitor the performance of our real database queries, not the performance of the access to the query cache.

collecting_queries_for_explain

(ActiveRecord::Explain, >= v3.2.1 <= v7.1.3.4)
Importance_1_sm

Executes the block with the collect flag enabled. Queries are collected asynchronously by the subscriber and returned.

to_query

(Object, >= v2.0.3 <= v7.1.3.4)
Importance_1_sm

Converts an object into a string suitable for use as a URL query string, using the given key as the param name.

clear_query_caches_for_current_thread

(ActiveRecord::ConnectionHandling, >= v6.0.0 <= v7.1.3.4)
Importance_1_sm

Clears the query cache for all connections associated with the current thread.

order

(ActiveRecord::QueryMethods, >= v3.0.0 <= v7.1.3.4)
Importance_5_sm

Applies an ORDER BY clause to a query. #order accepts arguments in one of several formats. symbols The symbol represents the name of the column you want to order the results by.

count_by_sql

(ActiveRecord::Querying, >= v3.2.1 <= v7.1.3.4)
Importance_2_sm

queries that can’t be executed using the ActiveRecord::Calculations class methods. Look into those before using this method, as it could lock you into a specific database engine or require a code change to switch database engines. Parameters sql - An SQL statement which should return a count query from

ActiveRecord::Store

Importance_3_sm

query that store outside the context of a single record. You can then declare accessors to this store that are then accessible just like any other attribute of the model. This is very helpful for easily exposing store keys to a form or elsewhere that’s already built around just

load_async

(ActiveRecord::Relation, >= v7.0.0 <= v7.1.3.4)
Importance_2_sm

Schedule the query to be performed from a background thread pool.

while_preventing_writes

(ActiveRecord::ConnectionHandling, >= v6.1.3.1 <= v7.1.3.4)
Importance_1_sm

write. while_preventing_writes will prevent writes to the database for the duration of the block. This method does not provide the same protection as a readonly user and is meant to be a safeguard against accidental writes. See READ_QUERY for the queries that are blocked by this method.

write_query?

(ActiveRecord::ConnectionAdapters::DatabaseStatements, >= v6.0.0 <= v7.1.3.4)
Importance_1_sm

Determines whether the SQL statement is a write query .

query

(ActiveRecord::ConnectionAdapters::PostgreSQL::DatabaseStatements, >= v4.2.1 <= v7.1.3.4)
Importance_1_sm

Queries the database and returns the results in an Array-like object

with_attached_*

(ActiveStorage::Attached::Model, >= v7.1.3.2 <= v7.1.3.4)
Importance_1_sm

Includes the attached blobs in your query to avoid N+1 queries. If ActiveStorage.track_variants is enabled, it will also include the variants record and their attached blobs.

size

(ActiveRecord::Associations::CollectionAssociation, >= v3.1.0 <= v7.1.3.4)
Importance_1_sm

query if the collection hasn’t been loaded, and calling collection. size if it has. If the collection has been already loaded size and length are equivalent. If not and you are going to need the records anyway length will take one less query. Otherwise size is more efficient. This

raw_connection

(ActiveRecord::ConnectionAdapters::AbstractAdapter, >= v1.1.6 <= v7.1.3.4)
Importance_1_sm

This is useful for when you need to call a proprietary method such as PostgreSQL’s lo_* methods. Active Record cannot track if the database is getting modified using this client. If that is the case, generally you’ll want to invalidate the query cache using +ActiveRecord::Base.clear_query_cache+.

ActiveSupport::LogSubscriber

Importance_2_sm

based on its given namespace. An example would be Active Record log subscriber responsible for logging queries: + ActiveSupport::LogSubscriber+ also has some helpers to deal with logging. For example, ActiveSupport::LogSubscriber.flush_all! will ensure that all logs are flushed, and it is called in Rails::Rack::Logger after a request finishes.

default_scopes?

(ActiveRecord::Scoping::Default::ClassMethods, >= v7.0.0 <= v7.1.3.4)
Importance_1_sm

Checks if the model has any default scopes. If all_queries is set to true, the method will check if there are any default_scopes for the model where all_queries is true.