Question: I have a virtual attribute, called currentBalance, in one of my models. An ajax call in my view populates this attribute. In the model I'm trying to validate that the net\_weight is less than or equal to the currentBalance which represents total net weight for a product in inventory. 

The problem is appears to be that net\_weight is a float and the currentBalance attribute comes back as a string resulting in an exception that says:

> 
> comparison of Float with String failed
> 
> 
> 

Here is the jquery that populates the currentBalance input field when a product is selected: 

```
$( ".fields" ).each( function(){    
    <% @currentBals.each do |c| %>
        if( $(this).find("option:selected").text() == '<%= c.material %>' ) {   
            $(this).find("input:text[readonly]").val("<%= number_with_delimiter(c.currentBal) %>")  
        } else {
            if ($(this).find("option:selected").text() == 'Select Material'){
                $(this).find("input:text[readonly]").val("<%=  number_with_delimiter(0) %>")
            }
        }
    <% end %>    

});

```

and here is the validation code in the model:

```
validates :net_weight, presence: true, numericality: { greater_than: 0.0, less_than_or_equal_to: :currentBalance }

```

I think that the number\_with\_delimiter formatting statement is causing the problem. But I want the value to be formatted in the view. 

How can I change the validation or convert the currentBalance attribute to be a float prior to the validation running?

Answer: 
ok If I got your problem right you are looking for a way to open a web page in the "default" browser.

That can be done by simply make a new process like:

```
Process.Start("http://google.com");

```

If you would like to control witch browser gets used you can do it by passing the web address to the browser's exe file as a parameter:

```
System.Diagnostics.Process.Start("PATH to exe", "Command Line Arguments");

```

To start the process in the new window pass a `ProcessInfo` object to the `Process.Start`
And set the `CreateNoWindow`
[more info on that](http://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo%28v=vs.110%29.aspx)
You should use System.Diagnostics.Process like that:

```
Process Chrome = new Process(); //Create the process
Chrome.StartInfo.FileName = @"C:\Program Files\Google\Chrome\Application\chrome.exe";  // Needs to be full path
Chrome.StartInfo.Arguments = ""; // If you have any arguments
Chrome.Start();

```