Skip to content
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

Enable String Literal rule styles in guides to be more consistent with codebase styles #49829

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions guides/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ inherit_from:
AllCops:
TargetRubyVersion: 3.0

Style/StringLiterals:
Enabled: false

Layout/IndentationConsistency:
Enabled: false

Expand Down
2 changes: 1 addition & 1 deletion guides/source/7_1_release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ development:
Alternatively, integration can be achieved using the `DATABASE_URL` environment variable:

```ruby
ENV['DATABASE_URL'] # => "trilogy://localhost/blog_development?pool=5"
ENV["DATABASE_URL"] # => "trilogy://localhost/blog_development?pool=5"
```

### Add `ActiveSupport::MessagePack`
Expand Down
20 changes: 10 additions & 10 deletions guides/source/action_cable_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ session, your session cookie is named `_session` and the user ID key is `user_id
can use this approach:

```ruby
verified_user = User.find_by(id: cookies.encrypted['_session']['user_id'])
verified_user = User.find_by(id: cookies.encrypted["_session"]["user_id"])
```

[`ActionCable::Connection::Base`]: https://api.rubyonrails.org/classes/ActionCable/Connection/Base.html
Expand Down Expand Up @@ -238,7 +238,7 @@ specific channel to handle raised exceptions:
```ruby
# app/channels/chat_channel.rb
class ChatChannel < ApplicationCable::Channel
rescue_from 'MyError', with: :deliver_error_message
rescue_from "MyError", with: :deliver_error_message

private
def deliver_error_message(e)
Expand Down Expand Up @@ -479,8 +479,8 @@ consumer.subscriptions.create({ channel: "ChatChannel", room: "Best Room" }, {
ActionCable.server.broadcast(
"chat_#{room}",
{
sent_by: 'Paul',
body: 'This is a cool chat app.'
sent_by: "Paul",
body: "This is a cool chat app."
}
)
```
Expand Down Expand Up @@ -548,7 +548,7 @@ class AppearanceChannel < ApplicationCable::Channel
end

def appear(data)
current_user.appear(on: data['appearing_on'])
current_user.appear(on: data["appearing_on"])
end

def away
Expand Down Expand Up @@ -697,8 +697,8 @@ application:
# Somewhere in your app this is called, perhaps from a NewCommentJob
WebNotificationsChannel.broadcast_to(
current_user,
title: 'New things!',
body: 'All the news fit to print'
title: "New things!",
body: "All the news fit to print"
)
```

Expand Down Expand Up @@ -787,7 +787,7 @@ passed to the server config as an array. The origins can be instances of
strings or regular expressions, against which a check for the match will be performed.

```ruby
config.action_cable.allowed_request_origins = ['https://rubyonrails.com', %r{http://ruby.*}]
config.action_cable.allowed_request_origins = ["https://rubyonrails.com", %r{http://ruby.*}]
```

To disable and allow requests from any origin:
Expand Down Expand Up @@ -841,7 +841,7 @@ the user account id if available, else "no-account" while tagging:

```ruby
config.action_cable.log_tags = [
-> request { request.env['user_account_id'] || "no-account" },
-> request { request.env["user_account_id"] || "no-account" },
:action_cable,
-> request { request.uuid }
]
Expand All @@ -865,7 +865,7 @@ listen for WebSocket requests on `/websocket`, specify that path to
```ruby
# config/application.rb
class Application < Rails::Application
config.action_cable.mount_path = '/websocket'
config.action_cable.mount_path = "/websocket"
end
```

Expand Down
18 changes: 9 additions & 9 deletions guides/source/action_controller_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ NOTE: Support for parsing XML parameters has been extracted into a gem named `ac
The `params` hash will always contain the `:controller` and `:action` keys, but you should use the methods [`controller_name`][] and [`action_name`][] instead to access these values. Any other parameters defined by the routing, such as `:id`, will also be available. As an example, consider a listing of clients where the list can show either active or inactive clients. We can add a route that captures the `:status` parameter in a "pretty" URL:

```ruby
get '/clients/:status', to: 'clients#index', foo: 'bar'
get "/clients/:status", to: "clients#index", foo: "bar"
```

In this case, when a user opens the URL `/clients/active`, `params[:status]` will be set to "active". When this route is used, `params[:foo]` will also be set to "bar", as if it were passed in the query string. Your controller will also receive `params[:action]` as "index" and `params[:controller]` as "clients".
Expand Down Expand Up @@ -207,7 +207,7 @@ end
And the following route:

```ruby
get '/books/:id', to: 'books#show'
get "/books/:id", to: "books#show"
```

When a user opens the URL `/books/4_2`, the controller will extract the composite
Expand Down Expand Up @@ -436,14 +436,14 @@ Rails sets up a session key (the name of the cookie) when signing the session da

```ruby
# Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: '_your_app_session'
Rails.application.config.session_store :cookie_store, key: "_your_app_session"
```

You can also pass a `:domain` key and specify the domain name for the cookie:

```ruby
# Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: '_your_app_session', domain: ".example.com"
Rails.application.config.session_store :cookie_store, key: "_your_app_session", domain: ".example.com"
```

Rails sets up (for the CookieStore) a secret key used for signing the session data in `config/credentials.yml.enc`. This can be changed with `bin/rails credentials:edit`.
Expand Down Expand Up @@ -669,7 +669,7 @@ into `String`s:
class CookiesController < ApplicationController
def set_cookie
cookies.encrypted[:expiration_date] = Date.tomorrow # => Thu, 20 Mar 2014
redirect_to action: 'read_cookie'
redirect_to action: "read_cookie"
end

def read_cookie
Expand Down Expand Up @@ -1104,7 +1104,7 @@ class MyController < ActionController::Base
include ActionController::Live

def stream
response.headers['Content-Type'] = 'text/event-stream'
response.headers["Content-Type"] = "text/event-stream"
100.times {
response.stream.write "hello world\n"
sleep 1
Expand Down Expand Up @@ -1140,7 +1140,7 @@ class LyricsController < ActionController::Base
include ActionController::Live

def show
response.headers['Content-Type'] = 'text/event-stream'
response.headers["Content-Type"] = "text/event-stream"
song = Song.find(params[:id])

song.each do |line|
Expand Down Expand Up @@ -1201,13 +1201,13 @@ Sometimes it's desirable to filter out from log files some sensitive locations y
You can do that by using the `config.filter_redirect` configuration option:

```ruby
config.filter_redirect << 's3.amazonaws.com'
config.filter_redirect << "s3.amazonaws.com"
```

You can set it to a String, a Regexp, or an array of both.

```ruby
config.filter_redirect.concat ['s3.amazonaws.com', /private_path/]
config.filter_redirect.concat ["s3.amazonaws.com", /private_path/]
```

Matching URLs will be marked as '[FILTERED]'.
Expand Down
2 changes: 1 addition & 1 deletion guides/source/action_mailbox_basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ class ForwardsMailboxTest < ActionMailbox::TestCase
test "directly recording a client forward for a forwarder and forwardee corresponding to one project" do
assert_difference -> { people(:david).buckets.first.recordings.count } do
receive_inbound_email_from_mail \
to: 'save@example.com',
to: "save@example.com",
from: people(:david).email_address,
subject: "Fwd: Status update?",
body: <<~BODY
Expand Down
Loading