The contract
The gem has two opinions about your app:
The gem has two opinions about your app:
context.current_user.can?(:symbol) # => true/false (required)
context.current_user.default_for(:symbol) # => value | nil (optional)can? gates visibility -- fields, variants, and entire tools. default_for populates JSON Schema default values from the current user's context. The symbols can mean anything:
current_user.can?(:manage_workflows) # permission
current_user.can?(:backward_routing) # feature flag
current_user.can?(:enterprise_plan) # plan tier
current_user.can?(:experiment_v2) # A/B test
current_user.default_for(:timezone) # => "America/Chicago"
current_user.default_for(:locale) # => "en-US"default_for is optional. If you don't use @default_for tags, you don't need it. When present, it's a simple case statement -- no metaprogramming:
def default_for(key)
case key
when :timezone then timezone
when :locale then locale
end
endCollected from README.md in the repository. Edit it there, not here.