Skip to content

Comments

Rename enable_updates to enable_cable_ready_updates#250

Merged
marcoroth merged 3 commits intomainfrom
enable-cable-ready-updates
Feb 13, 2023
Merged

Rename enable_updates to enable_cable_ready_updates#250
marcoroth merged 3 commits intomainfrom
enable-cable-ready-updates

Conversation

@marcoroth
Copy link
Member

@marcoroth marcoroth commented Feb 13, 2023

Type of PR

Enforcement of Consistency

Description

This pull request renames the two class methods and relation options related to the CableReady::Updatable module:

  • option enable_updates to enable_cable_ready_updates
  • class method enable_updates to enable_cable_ready_updates
  • class method skip_updates to skip_cable_ready_updates

Why should this be added

The class methods were super generic and didn't indicate that they were originating from CableReady. The method names were also more likely to clash with other upcoming gems which would port this behavior to a Turbo-related project.

Migration

All of the deprecated methods and the options emit a warning if they are used so people know how to migrate them.

enable_updates relation option

class Post < ApplicationRecord
  include CableReady::Updatable

- has_many :users, enable_updates: true
+ has_many :users, enable_cable_ready_updates: true
end

enable_updates class method

class Post < ApplicationRecord
  include CableReady::Updatable

- enable_updates
+ enable_cable_ready_updates
end

skip_updates class method

-Post.skip_updates do
+Post.skip_cable_ready_updates do
  # do something without broadcasting updates
end

Checklist

  • My code follows the style guidelines of this project
  • Checks (StandardRB & Prettier-Standard) are passing

Also rename `skip_updates` to `skip_cable_ready_updates`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant