206 results found for "{query"
where
(ActiveRecord::QueryMethods, >= v3.0.0 <= v7.1.3.4)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. Blank Condition If the condition is any blank-ish object, then #where is a no-op and returns
find_by_sql
(ActiveRecord::Querying, >= v3.2.1 <= v7.1.3.4)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
has_one
(ActiveRecord::Associations::ClassMethods, >= v1.0.0 <= v7.1.3.4)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
to_query
(ActionController::Parameters, >= v5.1.7 <= v7.1.3.4)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.
belongs_to
(ActiveRecord::Associations::ClassMethods, >= v1.0.0 <= v7.1.3.4)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
ActiveRecord::QueryLogs
Active Record Query Logs Automatically append comments to SQL queries with runtime information tags. This can be used to trace troublesome SQL statements back to the application code that generated these statements. Query logs can be enabled via Rails configuration in config/application.rb or an initializer:
query_constraints
(ActiveRecord::Persistence::ClassMethods, >= v7.1.3.2 <= v7.1.3.4)Accepts a list of attribute names to be used in the WHERE clause of SELECT / UPDATE / DELETE queries and in the ORDER BY clause for `#first` and `#last` finder methods.
encrypts
(ActiveRecord::Encryption::EncryptableRecord, >= v7.0.0 <= v7.1.3.4)querying encrypted text with Active Record . Deterministic encryption will use the oldest encryption scheme to encrypt new data by default. You can change this by setting deterministic: { fixed: false } . That will make it use the newest encryption scheme for encrypting new data. :support_unencrypted_data - If `config.active_record.encryption.support_unencrypted_data` is true
to_query
(Hash, >= v3.0.9 <= v7.1.3.4)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.
scope
(ActiveRecord::Scoping::Named::ClassMethods, >= v3.2.1 <= v7.1.3.4)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
execute
(ActiveRecord::ConnectionAdapters::DatabaseStatements, >= v1.0.0 <= v7.1.3.4)queries. Note: the query is assumed to have side effects and the query cache will be cleared. If the query is read-only, consider using #select_all instead. Note: depending on your database connector, the result returned by this method may be manually memory managed. Consider using #exec_query wrapper
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
exec_queries
(ActiveRecord::Relation::RecordFetchWarning, >= v5.0.0.1 <= v7.1.3.4)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
exec_query
(ActiveRecord::ConnectionAdapters::DatabaseStatements, >= v3.1.0 <= v7.1.3.4)Executes sql statement in the context of this connection using binds as the bind substitutes. name is logged along with the executed sql statement. Note: the query is assumed to have side effects and the query cache will be cleared. If the query is read-only, consider using #select_all instead.
clear_query_cache
(ActiveRecord::ConnectionAdapters::QueryCache, >= v2.0.3 <= v7.1.3.4)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.
scoping
(ActiveRecord::Relation, >= v3.0.0 <= v7.1.3.4)queries to the current scope. If all_queries: true is passed, scoping will apply to all queries for the relation including update and delete on instances. Once all_queries is set to true it cannot be set to false in a nested block. Please check unscoped if you want to remove
includes
(ActiveRecord::QueryMethods, >= v3.0.0 <= v7.1.3.4)queries. A separate query is performed for each association, unless a join is required by conditions. For example: NOTE: Conditions affect both sides of an association. For example, the above code will return only users that have a post named “example”, and will only include posts named “example”, even when
ActiveRecord::Enum
Declare an enum attribute where the values map to integers in the database, but can be queried by name. Example:
query_hash
(ActiveRecord::DatabaseConfigurations::ConnectionUrlResolver, >= v6.1.3.1 <= v7.1.3.4)Converts the query parameters of the URI into a hash.
execute_scope?
(ActiveRecord::Scoping::Default::ClassMethods, >= v7.0.0 <= v7.1.3.4)If all_queries is nil, only execute on select and insert queries. If all_queries is true, check if the default_scope object has all_queries set, then execute on all queries; select, insert, update, delete, and reload.
ActiveRecord::Encryption::ExtendedDeterministicQueries
querying both encrypted and unencrypted data Active Record Encryption supports querying the db using deterministic attributes. For example: This patches ActiveRecord to support this automatically. It addresses both: ActiveRecord::Base - Used in Contact.find_by_email_address(...) ActiveRecord::Relation - Used in Contact.internal.find_by_email_address(...) This module is included if `config.active_record.encryption.extend
url_for
(ActionDispatch::Routing::UrlFor, >= v3.0.0 <= v7.1.3.4)query parameters to be appended to the path. :path_params - The query parameters that will only be used for the named dynamic segments of path. If unused, they will be discarded. :trailing_slash - If true, adds a trailing slash, as in "/archive/2009/" . :script_name - Specifies application path relative
explain
(ActiveRecord::Relation, >= v3.2.1 <= v7.1.3.4)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
has_many
(ActiveRecord::Associations::ClassMethods, >= v1.0.0 <= v7.1.3.4)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
preload
(ActiveRecord::QueryMethods, >= v3.0.0 <= v7.1.3.4)Specify associations args to be eager loaded using separate queries. A separate query is performed for each association.
composite_query_constraints_list
(ActiveRecord::Persistence::ClassMethods, >= v7.1.3.2 <= v7.1.3.4)Returns an array of column names to be used in queries. The source of column names is derived from query_constraints_list or primary_key . This method is for internal use when the primary key is to be treated as an array.
normalizes
(ActiveRecord::Normalization::ClassMethods, >= v7.1.3.2 <= v7.1.3.4)query methods. This allows a record to be created and later queried using unnormalized values. However, to prevent confusion, the normalization will not be applied when the attribute is fetched from the database. This means that if a record was persisted before the normalization was declared, the record’s attribute
cache_key
(ActiveRecord::Relation, >= v5.0.0.1 <= v7.1.3.4)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.
ActiveRecord::ConnectionAdapters::ConnectionPool
queries executing on that thread. It is not required to explicitly pass the checked out connection to Rails models or queries, for example. Options There are several connection-pooling-related options that you can add to your database connection configuration: pool: maximum number of connections the pool may manage (default
sql
(Arel, >= v6.0.0 <= v7.1.3.4)query methods, e.g. Great caution should be taken to avoid SQL injection vulnerabilities. This method should not be used with unsafe values such as request parameters or model attributes. Take a look at the security guide for more information. To construct a more complex query fragment, including the possible use of user