Question: I am implementing a basic sync strategy for a multi-client application that needs to support offline data access. I am using @Chris' suggestion in his answer to [this question](https://stackoverflow.com/questions/5035132/how-to-sync-iphone-core-data-with-web-server-and-then-push-to-other-devices) (not required reading).

One detail I would like to add is the ability to resolve conflicts based on the last change saved, **not** the last change synced. In other words, if two clients update the same item, the client that saved the change last should win, even if the other client syncs later.

Clearly I need some way to timestamp each change on the client, so I can compare the stamps on the server at the time of sync. However, I can't guarantee much about each client's internal clock.

I would like to know if there is an established way to solve this? The simpler the better!

Answer: 
You need to do a few things to get this to work:

1. Set the `allowClear` and `placeholder` options in an options object that you use when initializing the widget:

```
$ ->
  $("#practice_toolkeeper")
      .select2({ 
          allowClear: true,
          placeholder: 'Select type question'
      })
      .select2('val',$("#toolkeeper_value").val())

```
2. It looks like the `allowClear` option only works when there's an empty `option` in the `select`. To generate an empty option you could use `{:include_blank => true}` when generating the select:

```
<%= f.select :toolkeeper, options_from_collection_for_select(@people, :id, :name), {:include_blank => true} %>

```

Basically you want your HTML to look like this:

```
<select id="practice_toolkeeper" name="practice[toolkeeper]">
    <option value=""></option>
    <option value="21">sdifj</option> 
    <!-- etc -->
</select>

```

**Example:** <http://jsfiddle.net/Z63d7/>
*For My Developer Fellas Landed here*

Suppose You are using [Formtastic](https://github.com/justinfrench/formtastic) Normally with Active Admin You can pass during declaration

```
f.input :your_select_2_field, { as: :select2, collection: ['a', 'b'], include_blank: 'Select Nothing'}

```

**Concentrate On Curly Braces {}**

-Happy Coding :)