152 results found for "{query"
where
(ActiveRecord::QueryMethods, >= v3.0.0 <= v7.1.3.2)query generated may be different depending on the database adapter. string A single string, without additional arguments, is passed to the query constructor as an SQL fragment, and used in the where clause of the query. See WhereChain for more details on #not. blank condition If the condition is any blank
has_many
(ActiveRecord::Associations::ClassMethods, >= v1.0.0 <= v7.1.3.2)query of collections of associated objects will be added: collection is a placeholder for the symbol passed as the name argument, so has_many :clients would add among others clients.empty? . collection Returns a Relation of all the associated objects. An empty Relation is returned if none are found. collection<<(object
to_query
(ActionController::Parameters, >= v5.1.7 <= v7.1.3.2)Returns a string representation of the receiver suitable for use as a URL query string: The string pairs “key=value” that conform the query string are sorted lexicographically in ascending order. This method is also aliased as to_param .
belongs_to
(ActiveRecord::Associations::ClassMethods, >= v1.0.0 <= v7.1.3.2)query for a single associated object, for which this object holds an id: association is a placeholder for the symbol passed as the name argument, so belongs_to :author would add among others author.nil? . association Returns the associated object. nil is returned if none is found. association=(associate) Assigns the associate
has_one
(ActiveRecord::Associations::ClassMethods, >= v1.0.0 <= v7.1.3.2)query of a single associated object will be added: association is a placeholder for the symbol passed as the name argument, so has_one :manager would add among others manager.nil? . association Returns the associated object. nil is returned if none is found. association=(associate) Assigns the associate object, extracts the primary
find_by_sql
(ActiveRecord::Querying, >= v3.2.1 <= v7.1.3.2)query. If you call a complicated SQL query which spans multiple tables, the columns specified by the SELECT will be attributes of the model, whether or not they are columns of the corresponding table. The sql parameter is a full SQL query as a string. It will be called as is; there
scope
(ActiveRecord::Scoping::Named::ClassMethods, >= v3.2.1 <= v7.1.3.2)querying objects. The method is intended to return an ActiveRecord::Relation object, which is composable with other scopes. If it returns nil or false, an {all}[rdoc-ref:Scoping::Named::ClassMethods#all] scope is returned instead. A scope represents a narrowing of a database query, such as where(color: :red).select
to_query
(Hash, >= v3.0.9 <= v7.1.3.2)Returns a string representation of the receiver suitable for use as a URL query string: The string pairs “key=value” that conform the query string are sorted lexicographically in ascending order. This method is also aliased as to_param .
exec_queries
(ActiveRecord::Relation::RecordFetchWarning, >= v5.0.0.1 <= v7.1.3.2)query returns is greater than the value of warn_on_records_fetched_greater_than, a warning is logged. This allows for the detection of queries that return a large number of records, which could cause memory bloat. In most cases, fetching large number of records can be performed efficiently using
ActiveRecord::UnknownAttributeReference
query method. For example, passing a non column name value to a relation’s #order method might cause this exception. When working around this exception, caution should be taken to avoid SQL injection vulnerabilities when passing user-provided values to query methods. Known-safe values can be passed to query
clear_query_cache
(ActiveRecord::ConnectionAdapters::QueryCache, >= v2.0.3 <= v7.1.3.2)Clears the query cache . One reason you may wish to call this method explicitly is between queries that ask the database to randomize results. Otherwise the cache would see the same SQL query and repeatedly return the same result each time, silently undermining the randomness you were expecting.
query_hash
(ActiveRecord::DatabaseConfigurations::ConnectionUrlResolver, >= v6.1.3.1 <= v7.1.3.2)Converts the query parameters of the URI into a hash.
explain
(ActiveRecord::Relation, >= v3.2.1 <= v7.1.3.2)query or queries triggered by this relation and returns the result as a string. The string is formatted imitating the ones printed by the database shell. Note that this method actually runs the queries, since the results of some are needed by the next ones when eager loading is going
ActiveRecord::Enum
Declare an enum attribute where the values map to integers in the database, but can be queried by name. Example:
cache_key
(ActiveRecord::Relation, >= v5.0.0.1 <= v7.1.3.2)Returns a stable cache key that can be used to identify this query. The cache key is built with a fingerprint of the SQL query.
cache_version
(ActiveRecord::Relation, >= v6.0.0 <= v7.1.3.2)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::Result
This class encapsulates a result returned from calling {#exec_query}[rdoc-ref:ConnectionAdapters::DatabaseStatements#exec_query] on any database connection adapter. For example:
ActiveRecord::Base
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
to_query
(Array, >= v3.0.0 <= v7.1.3.2)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.2)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.
ActiveRecord::DelegatedType
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: Now you can list a bunch of entries, call +Entry#title+, and polymorphism will provide you with the answer.
exists?
(ActiveRecord::FinderMethods, >= v3.0.0 <= v7.1.3.2)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.2)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.
ActionController::Streaming
queries are made, and the layout is processed. Streaming inverts the rendering flow by rendering the layout first and streaming 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
cacheable_query
(ActiveRecord::ConnectionAdapters::DatabaseStatements, >= v4.2.1 <= v7.1.3.2)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.2)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
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.2)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.2)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.2)Clears the query cache for all connections associated with the current thread.