forked from rails/rails
-
Notifications
You must be signed in to change notification settings - Fork 0
Activerecord log to STDOUT on console #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
coorasse
wants to merge
1,811
commits into
main
Choose a base branch
from
activerecord_console
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
We're describing the framework, not the module. Co-authored-by: Adrianna Chang <[email protected]>
Action Pack can be used without Rails Co-authored-by: Adrianna Chang <[email protected]>
Previously these tests would unsubscribe _all_ subscribers for
{unsafe,open}_redirect notifications. This becomes a problem when Action
Pack provides a default subscription for these events because those
subscribers will get unsubscribed as well.
This commit fixes the issue by only unsubscribing the subscriber used
in the tests.
Co-authored-by: Adrianna Chang <[email protected]>
Various event related fixes
Add `tzdata-legacy` package for Debian 13 (trixie) based image
…eanup Polish docs in `caching_with_rails` markdown file
[ci skip] Warn against using arbitrary user supplied image transformations
…present
When generating a Rails app with CSS bundling, e.g., `rails new myapp --css tailwind --js esbuild`, the browser shows:
GET /assets/tailwindcss net::ERR_ABORTED 404 (Not Found)
The problem:
1. CSS build tools output to `app/assets/builds/application.css`
2. The generated layout has `stylesheet_link_tag :app`, which expands to link tags for ALL .css files in app/assets/:
<link rel="stylesheet" href="/assets/application-{hash}.css">
<link rel="stylesheet" href="/assets/application.tailwind-{hash}.css">
3. The source file application.tailwind.css shouldn't be served directly: only the built output (application.css) should be linked.
This fix:
- Adds `using_css_bundling?` helper to detect when CSS bundlers are used
- Updates layout template to use "application" when --css is present
- Applies to all CSS bundlers (tailwind, sass, postcss, bootstrap, bulma)
…-lower-unbounded-pg-time-ranges Use -infinity for lower value of unbounded PG time ranges
Fix rails#56087 When processing rows, `JoinDependency#instantiate` stores instantiated models in hash indexed by their primary key. The current code does not properly handle models with a composite primary key, and this can result in duplicate records being returned.
…k-tag Fix rails new to use stylesheet_link_tag "application" when --css is present
This is an adapter-internal object that represents a caller's desire that a given query be run, encapsulating the SQL, binds, and various control parameters like allow_retry. Immutable here, but mutable attributes to follow.
Carry the type-casted binds and notification payload once they're available; update #async to reflect whether the query was actually run asynchronously.
It was documented despite being private, so we continue accepting the old separated parameter set with a deprecation warning. The method is no longer documented: since the consolidation onto perform_query, individual adapters should not need to know about it.
This moves intent-unpacking to the same boundary where we start talking to the raw connection.
The work stays in the adapter, but we now construct the intent with the original SQL, to be stored separately from the final preprocessed form.
Following the SQL preprocessing, further allow QueryIntent to be constructed with an Arel-shaped query.
These are purely less-powerful versions of their non-prefixed public API equivalents, and the adapter has far too many query-running methods to justify keeping obscure variants for compatibility. For update and delete, these are now entirely vestigial. For insert, some adapters need to be able to intervene, so I've moved the real work to _exec_insert.
…es-when-eager-loading-models-with-composite-primary-key Prevent duplicates when eager-loading models with a composite primary key
Introduce Parameter Object: QueryIntent
Add code examples section to guides guidelines.
- Add screenshots when talking about the views to aid users to see the UI impact - Show the structure of the engine - A bit more info about the engives vs. plugins - Update a lot of sections to have further sub sections - Update the `:path` option for the gem - Fix the example for the overridden view in the application to reflect author.name - Move Testing an Engine into Improving the Engine - Update some sections to be more clear - Update the `Blorgh::Article.find(1)` example to first create an article instead? `Blorgh::Article.create(title: "Hello World")` - remove references to`attr_accessor`, `cattr_accessor` and keep and link `mattr_accessor` because the former two don't seem necessary. - Update the title to be consistent "Engines Overview"? - Maybe the introduction of generating the plugin with `--mountable` should be moved to the "Plugins" guide? We've added this there but also mentioned it here - Maybe the `app` directory section could use some code examples instead of describing the namespaced classes inline? I felt like we've covered examples throughout the guide in detail adn I'd even added more so I kept this to be about the structure but if reviewers feel much differently, happy to amend. - The timestamp placeholder `[timestamp_1]` should maybe be made more consistent with other placeholders in the guide? `<timestamp_1>` See: rails#53208 - The `bin/rails generate migration add_author_id_to_blorgh_articles author_id:integer` command uses snake_case for the migration name while we mostly uses CamelCase in other guides. This should probably be documented in the Guidelines as well. --------- Co-authored-by: Petrik de Heus <[email protected]> Co-authored-by: Rafael Mendonça França <[email protected]> Co-authored-by: Gannon McGibbon <[email protected]>
Upgrade GitHub Actions upload-artifact to v5
…main Add ability to use a block when rendering a collection
Copying files and directories can't be done in a single `COPY` command because the `COPY` command has no way to copy directories, only their content. Fix: rails#56081 Co-Authored-By: Zhong Sheng <[email protected]>
This commit fixes a problem introduced when the libjemalloc2
dependency was added to the following file for creating the Dockerfile.
The base packages string in the Dockerfile was not being replaced as
expected because the BASE_PACKAGES string in the generator had not been
updated with the new dependency.
railties/lib/rails/generators/app_base.rb
Line 614: packages << "libjemalloc2"
The Dockerfile.test fixture was not updated accordingly, despite
Dockerfiles in new rails apps having this dependency. This allowed
the db_system_change_generator_test.rb to pass, despite the base
packages remaining unchanged.
I updated the BASE_PACKAGES string in the generator, and updated the
Dockerfile fixture and the generator test accordingly.
Commands run successfully:
bundle exec rubocop \
railties/lib/rails/generators/rails/db/system/change/ \
change_generator.rb
bundle exec rubocop \
railties/test/generators/db_system_change_generator_test.rb
bin/test test/generators/db_system_change_generator_test.rb
Use Digest::UUID.uuid_v5 to generate uuid instead of hand-rolled
… and block (rails#56293) * Combine rather than overwrite tag content supplied via both parameter and block Before we were overwriting the parameter content with the block content * Add changelog entry * Fix the quotes for rubocop's liking
…er-connection_pool Fix `MemCacheStore` for `connection_pool` >= 3
…age-url-fix ActionText: Validate `RemoteImage` URLs
* Active storage immediate variants (rails#6) * This commit introduces variant generation strategies for Active Storage, providing more flexible control over when variants are created. - **:lazily** - variants created dynamically when requested (default) - **:later** - variants created in background after attachment - **:immediately** - variants created simultaneously with attachment ```ruby has_one_attached :avatar_with_lazy_variants do |attachable| attachable.variant :lazy_thumb, resize_to_limit: [3, 3], process: :lazy attachable.variant :default_thumb, resize_to_limit: [4, 4] end has_one_attached :avatar_with_later_variants do |attachable| attachable.variant :later_thumb, resize_to_limit: [2, 2], process: :later end has_one_attached :avatar_with_immediate_variants do |attachable| attachable.variant :immediate_thumb, resize_to_limit: [1, 1], process: :immediately end ``` * Active Storage: make Variant#processed? and VariantWithRecord#processed? public Apps can now check whether variants have been generated. Useful for precise control of variant usage or generation. Co-authored-by: Tom Rossi <[email protected]> * Deprecate `preprocessed: true` in favor of `process: :later` For removal in Rails 9.0. Co-authored-by: Tom Rossi <[email protected]> * Document immediate variants: guide and changelog Co-authored-by: Tom Rossi <[email protected]> * Making ActiveStorage::Preview#processed? a public method Removing space * Use consistent naming for transformations parameter (rails#7) ActiveStorage uses the plural `transformations` for a single hash of transformation options (e.g., `{ resize_to_limit: [100, 100] }`). To differentiate between a single transformation hash and an array of transformation hashes, this commit introduces `transformations_array` for arrays of transformations, while retaining transformations for individual hashes. * Fixing changelog * Rename transformations_array to variants Aligns with `CreateVariantsJob` naming and `ActiveStorage` terminology where variants represent the result of transformations applied to the original blob. Fixing create_preview_image --------- Co-authored-by: Jeremy Daer <[email protected]> Co-authored-by: Tom Rossi <[email protected]>
fix(activesupport): handle syntax errors in debug views when using editor
Use pattern matching on sql instead of string match event payload name
[ci skip] Update getting_started.md to point to application.html.erb for navbar menu entry
This can be disabled with `-w` or `--skip_executor`, same as runner.
Related to [rails/actiontext#41](rails/actiontext#41) The introduction of the `ActionText::TrixEditor` class enables the deprecation of a variety of class- and instance-level methods across the `ActionText` namespace. Action Text benefits from deprecating methods in order to reduce its public API. There are two categories of deprecations in this changeset: `module`/`class` deprecations and method deprecations. The `module` and `class` deprecations target modules that are internal and "private" in intent, but public in Ruby and not marked as `:nodoc:`. They're either particular to Trix, or their responsibilities have been given to `ActionText::Editor`. The method deprecations also target methods that are internal and "private" in intent, but `public` in Ruby and not marked as `:nodoc:`. In general, determining whether or not to deprecate a method hinged on whether its name or arguments mentioned `"trix"`, *or* if it lacked method-level documentation or comments of any kind. When possible, the previous code paths have been deprecated *and* re-implemented in terms of an `ActionText::TrixEditor` instance. Additions --- The main aim of this changeset is to provide a single, extensible entrypoint for third-party editors (that are not Trix) to integrate with Action Text. The initial responsibilities of the `ActionText::TrixEditor` have been determined by consolidating a variety of (class- and instance-) methods across a variety of classes to reduce the number of touchpoints for applications and engines that provide third-party editor integrations. The vast majority of its method definitions are direct copy-and-pastes from their original sources. Any method that previously mentioned `trix` in its name or argument list has replaced and generalized that occurrence with `editor`. Classes that inherit from `ActionText::Editor` can override two methods that accept and return `Fragment` instances: * `Editor#as_canonical` method accepts an editor-sourced `ActionText::Fragment` instance, transforms it, then returns an `ActionText::Fragment` instance to be stored. * `Editor#as_editable` method accepts a storage-sourced `ActionText::Fragment` instance, transforms it, then returns an `ActionText::Fragment` instance to be edited. The interface utilizes `Fragment` instances rather than `Content` or String instances. The `Fragment` class serves as an agnostic layer on top of HTML and Plain Text string manipulation through Nokogiri. It has a simple interface of transforms: * `find_all(selector)` * `update(&block)` * `replace(selector, &block)` Accepting **and** returning a transformation-ready `Fragment` enables a more consistent adapter interface. Changes --- *These changes aim to be considered implementation details, and intend to remain "private" from an API perspective.* Future commits can be made to expand upon and document the responsibilities of the adapter's interface.
Respect config.log_level to emit debug events
- Remove duplicate "the" on line 1371 - Remove duplicate "assets:clobber" line - Add missing space before backtick on line 971
Fix typos in command line guide
rails#56208) Fix bug when isolation would not reset or when requires_new is used
* Fix typos in JavaScript guide - Fixed async js code example
The STRICT_LOCALS_REGEX pattern used `(.*)` which doesn't match
newlines by default in Ruby. When the locals magic comment spanned
multiple lines, the regex failed to capture the full content.
Changed the regex to use `(.*?)` with the `m` flag (multiline mode)
to properly match across line breaks while remaining non-greedy.
Before (broken):
<%# locals: (arg_1:,
arg_2: nil,
arg_3: []) %>
After (works):
The multiline comment is now parsed correctly, and default values
are properly applied.
Fixes rails#12345
Co-Authored-By: Jean Boussier <[email protected]>
Wrap console command with an executor by default
…ls-parsing Fix ERB strict locals parsing when comment spans multiple lines
This commit wraps HTTP request tests and RuboCop output with `quietly` blocks to suppress output during test execution.
Fix dumping materialized views indexes
The built-in authentication generator uses `email_address` as the column name for the User model. Update the Action Mailer Basics guide to use `email_address` instead of `email` for consistency. This change updates all code examples in the guide to match the convention established by the authentication generator, making it easier for developers to follow along without confusion. [ci skip]
…thesis-in-next-line ActionView Strict Locals: Adds support for case when closing parenthesis is on next line
Suppress unnecessary output in railties tests
…email-address-consistency
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation / Background
Every time I set up a new Rails app, I find myself configuring the following:
because I want to see the ActiveRecord logs printed on the console. Working with an ActiveRecord object is the Number 1 reason why I use the rails console.
I wonder if this is the right approach or if we should set this by default in application.rb in new rails apps, but I decided to bring the point nevertheless.
Checklist
Before submitting the PR make sure the following are checked:
[Fix #issue-number]