Skip to content

Disable setting default_options hash directly #92

Description

@shioyama

Context

Since 0.2.0, it has become possible to set Mobility.default_options which are merged into the options set whenever translates is called on a Mobility model. However, the problem with this is that the "default" default_options is overridden if the user sets these options with Mobility.default_options =, which will typically disable "low-profile" plugins like presence and cache.

Expected Behavior

Setting Mobility.default_options = raises an error and instructs the user to set options by their key, e.g.:

Mobility.configure do |config|
  # ...

  config.default_options[:fallbacks] = { ... }
  config.default_options[:dirty] = true
  # ...
end

Actual Behavior

Mobility allows default options to be overridden entirely, implicitly disabling any options which were previously true but now are nil.

Possible Fix

Add a deprecation warning on the setter in 0.3.0, and remove thereafter.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions