ActiveRecord + self.site dynamic url value

Hello Everyone,

I am using rails 4 version and i am using ActiveRecord to GET and POST data to other rails application.

Below is my product model code

// product.rb

require ‘active_resource’

class Product < ActiveResource::Base

self.site = “http://localhost:5000/

def other_method

true

end

end

My problem is how can i change site url which is in the product model dynamically based on users selection. I have Site model, in that i have list of sites. User should select one site when they try to create a product…

Regards

Saravanan P