cremes.devlist-ee4meeAH724@public.gmane.org
2006-Nov-18 22:09 UTC
ActiveResource sample code?
I''d like to play around a bit with ActiveResource for consuming a web service. Does anyone have sample code they would be willing to share? I''ve googled all around and have come up empty except for simple (non- working) examples given in the RailsConf keynote and some associated blog entries. Thanks! cr --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 11/18/06, cremes.devlist-ee4meeAH724@public.gmane.org <cremes.devlist-ee4meeAH724@public.gmane.org> wrote:> > I''d like to play around a bit with ActiveResource for consuming a web > service. Does anyone have sample code they would be willing to share? > I''ve googled all around and have come up empty except for simple (non- > working) examples given in the RailsConf keynote and some associated > blog entries.$LOAD_PATH << "/path/to/activeresource/lib" require ''active_resource'' class Job < ActiveResource::Base self.site = URI.parse(''http://localhost:3000'') def done! connection.post "/jobs/#{id}.xml;done" end end # GET /jobs.xml calls JobsController#index puts Job.find(:all).inspect # POST /jobs/1.xml;done calls JobsController#done with params[:id] == 1 job.done! Check out the scaffold_resource generator for instantly available resources: ./script/generate scaffold_resource Job worker:string command:text description:text started_at:datetime finished_at:datetime Best, jeremy --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---