empty?

empty?() Instance Public methods Returns true if there are no records.

explain

explain() Instance Public methods Runs EXPLAIN on the 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 on. Please see further details in the Active Record Query Interface guide.

find_or_create_by

find_or_create_by(attributes, &block) Instance Public methods Finds the first record with the given attributes, or creates a record with the attributes if one is not found: # Find the first user named "Penélope" or create a new one. User.find_or_create_by(first_name: 'Penélope') # => #<User id: 1, first_name: "Penélope", last_name: nil> # Find the first user named "Penélope" or create a new one. # We already have one so the existing record will be returned. User.f

find_or_create_by!

find_or_create_by!(attributes, &block) Instance Public methods Like find_or_create_by, but calls create! so an exception is raised if the created record is invalid.

find_or_initialize_by

find_or_initialize_by(attributes, &block) Instance Public methods Like find_or_create_by, but calls new instead of create.

initialize_copy

initialize_copy(other) Instance Public methods

inspect

inspect() Instance Public methods

joined_includes_values

joined_includes_values() Instance Public methods Joins that are also marked for preloading. In which case we should just eager load them. Note that this is a naive implementation because we could have strings and symbols which represent the same association, but that aren't matched by this. Also, we could have nested hashes which partially match, e.g. { a: :b } & { a: [:b, :c] }

load

load() Instance Public methods Causes the records to be loaded from the database if they have not been loaded already. You can use this if for some reason you need to explicitly load some records before actually using them. The return value is the relation itself, not the records. Post.where(published: true).load # => #<ActiveRecord::Relation>

many?

many?() Instance Public methods Returns true if there is more than one record.