diff --git a/README.md b/README.md index 410d439..b52a5c1 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,28 @@ gem "trailblazer-pro-rails" Note: we're currently playing with various invocation styles and at some point you might not even have to use `Operation.wtf?` anymore. +## Configuration (optional) +Configure your operations to use the web debugger, example configuration: +```ruby +# config/environments/development.rb +config.trailblazer.pro.trace_operations = { + "API::V1::Diagram::Operation::Update" => true, + "API::V1::Diagram::Operation::Create" => true, +} +``` + +Or, if you want to trace all operations, use `:all` as the value. +```ruby +# config/environments/development.rb +config.trailblazer.pro.trace_operations = :all +``` + +Disable printing trace to console, show only link to web debugger. +```ruby +# config/environments/development.rb + config.trailblazer.pro.render_wtf = false +``` ## Testing diff --git a/lib/trailblazer/pro/rails/railtie.rb b/lib/trailblazer/pro/rails/railtie.rb index 4a05242..fb69156 100644 --- a/lib/trailblazer/pro/rails/railtie.rb +++ b/lib/trailblazer/pro/rails/railtie.rb @@ -24,15 +24,17 @@ class Railtie < ::Rails::Railtie trace_operations = config.trailblazer.pro.trace_operations if trace_operations - # constants can be passed as strings to avoid autoloading issues. - trace_operations = trace_operations.collect { |klass, config| [klass.constantize, config] }.to_h + if trace_operations.is_a?(Hash) + # constants can be passed as strings to avoid autoloading issues. + trace_operations = trace_operations.collect { |klass, config| [klass.constantize, config] }.to_h + end Pro.trace_operations!(trace_operations) end # TODO: add {Activity.invoke} here, too! # Trailblazer::Activity.extend(Pro::Call::Activity) # FIXME: only if allowed! # TODO: only apply to selected OPs. - else # no configuration happend, yet. + else # no configuration happened, yet. Pro.initialize!(api_key: "") end end