Question: I have a select and a function bound to on change (ng-change), the thing is I want this function to work when the user clicks the already selected element, so they can easily reuse the already selected action.

This is my html (with [Slim](http://slim-lang.com/))

```
select ng-model="selectedAction" ng-options="action.label for action in Actions" ng-change="chooseAction()"
    option ng-selected="users.items.length == 0" value="" Select an Action

```

Is this possible or I'll have to add a button to make it work?

Already saw [this](https://stackoverflow.com/questions/5964362/select-already-selected-item-in-dropdown-select-list) and [this](https://stackoverflow.com/questions/3354367/html-select-element-onchange-trigger-for-already-selected-option), looking for another solution.

Answer: 
Use `is_a?` to inspect the type:

```
def getValue(x) 
    puts "Key: #{x}"
    if x.is_a?(Integer)
        puts "x is an int"
    else
        puts "x is a string"
    end
end

```

Output:

```
irb> getValue(1)
Key: 1
x is an int
irb> getValue("1")
Key: 1
x is a string

```
You might want to test if it can be converted to an integer, not if it is one:

```
def get_value(x)
  puts "Key: #{x}"

  # This throws an ArgumentError exception if the value cannot be converted
  Integer(x)

  puts "x is an int"

rescue ArgumentError
  puts "x is not an integer"
end

```