I have a number of ActiveResource classes that I won't know the site for until runtime. The current definition for one of these resources looks like this class ResourceSiteDetail < ActiveResource self.element_name = "site_detail" self.site = "https://somesubdomain.mydomain.com" self.user = XXXX self.password = XXXXXX self.timeout = 10 end I need to set the site url at runtime rather than at class definition time Is it possible to pass the url in as a parameter? Ideally I would like to do something like @sd = ResourceSiteDetail.new("fred") and have in the class definition look like this class ResourceSiteDetail < ActiveResource self.element_name = "site_detail" self.site = "https://#{site_name}.mydomain.com" #How do I get site_name passed in as a parameter? self.user = XXXX self.password = XXXXXX self.timeout = 10 end But I am totally stumped as to how to achieve this. Any ideas at all would be greatly appreciated
on 2009-09-06 23:04
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.