Yanni Mac wrote:
> Here is the full implementation in case anyone is interested.
> 
> Server 2 needs to get a widget object from server 1
> 
> 
> Server 1 code
> --------------
> WidgetController
> def show_widget_yaml
>   @widget = Widget.find(params[:id])
>   render  :layout =>  false
> end
> 
> show_widget_yaml.rhtml
> <%=YAML.dump(@product)%>
> 
> 
> 
> Server 2 code
> ------------
> def show
>   client = HTTPClient.new
>   response = 
> client.get('http://www.server1/widgets/show_widget_yaml'+params[:id])
>   yaml_string = response.body.content
>   @product = Product.new
>   @product = YAML.load(yaml_string)
> end


Correction..  I forgot to replace some variable names from my own code


Server 1 code
-----------------
 WidgetController
 def show_widget_yaml
   @widget = Widget.find(params[:id])
   render  :layout =>  false
 end

 show_widget_yaml.rhtml
 <%=YAML.dump(@widget)%>



 Server 2 code
 ------------
 def show
   client = HTTPClient.new
   response =
     client.get('http://www.server1/widgets/show_widget_yaml'+params[:id])
   yaml_string = response.body.content
   @widget = Widget.new
   @widget = YAML.load(yaml_string)
 end


-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to