# TurboSteam and variants

**URL:** <https://discuss.hotwired.dev/t/turbosteam-and-variants/2349>\
**Category:** General\
**Created:** [February 20, 2021, 2:58pm UTC](https://discuss.hotwired.dev/t/turbosteam-and-variants/2349 "2021-02-20T14:58:37Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![mtomov](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/mtomov/32/1182_2.png) [@mtomov](https://discuss.hotwired.dev/u/mtomov)\
**Post date:** [February 25, 2021, 12:42pm UTC](https://discuss.hotwired.dev/t/turbosteam-and-variants/2349/9 "2021-02-25T12:42:16Z")

</div>

I do agree that keeping it to one view is best in this case, but wanted to show you how to go about passing data from the “controller space” into background jobs:

This is the example, which implements it:

> <https://github.com/influitive/apartment-activejob/blob/master/lib/apartment/active_job.rb>

1. Create a `device_variant` in a `Current` model, i.e.

```ruby
class Current < ActiveSupport::CurrentAttributes
  attribute :device_variant
end

```

1. Set `device_variant` on the controller level in a before action

```ruby
Current.device_variant = request.variant

```

1. Add the current parameter to all jobs - see the `#serialize` from the example

```ruby
    def serialize
      super.merge('device_variant' => Current.device_variant)
    end

```

1. Finally, access `device_variant` as in the example code, or I think it should also be available directly in the job with `self.arguments`, but I haven’t tried it.

---

_[View the full topic](https://discuss.hotwired.dev/t/turbosteam-and-variants/2349)._
