Question: I have a simple bootstrap grid with a row displaying some text in one column and a stacked font-awesome icon set in another column. The issue I'm having is the **icon-set is not vertically aligned in the middle of the div, as the text is**. As you can see the icon is more aligned to the top of the div. Is there a way to center align this?

I've created a [fiddle here](https://jsfiddle.net/sjehvfvj/) and re-posted the code below:

html:

```
<div class="container-fluid">
  <div class="row posted-content">
    <div class="col-md-10">
      <h4 class="text-primary pull-left">Hey, this is some text</h4>
    </div>
    <div class="col-md-2 comment-count pull-right">
      <a class="fa-stack comment-action">
        <i class="fa fa-comment-o fa-fw fa-stack-2x"></i>
        <i class="fa fa-stack-1x">5</i>
      </a>
    </div>
  </div>
</div>

```

css:

```
.posted-content {
  border-radius: 4px;
  border-color: #e7e7e7;
  border: 1px solid rgba(0, 0, 0, 0.1);
  max-width: 1140px;
  background-color: #f8f8f8;
  margin-bottom: 0px;
  vertical-align: middle;
}

```

I've tried playing with vertical-align but to no avail. Any ideas appreciated.

Answer: 
In order to have a "global" state, then you need to create a singke dependency for each instance of your application.

In fact, you can't rely on cookies or sessions, are they are client-oriented and they are not shared between clients.

The database is the most common approach. You *may* be able to use the file system in some cases, but not for Heroku as there may be several different instances of your app running under different file systems.

Any solution that can easily be shared across instances will work:

* Memory database like Redis
* SQL or NoSQL database
* Cache systems, as long as they are not specific to one instance. Memcached may work, but it's not persistent (hence you may lose the state)
* External storage (such as Amazon S3)

To me, a relational database or a memory database such as Redis seems to be the most plausible solution.
You could put it in a table - just so that you have it, but then make the value available via the ApplicationContoller, with a simple cache method in between

so something like: - not tested!!

```
def get_mode
  if @mode_timeout.nil? or @mode_timeout < Time.now
    @mode = ModeModel.first.mode
    @mode_timeout = Time.now + 60.seconds
  end
  @mode
end

```

You'll have to create a model, or you could update if via a controller with a set\_mode method instead, but that would be more transient.

Then you can just call get\_mode from your controller.