From john at siberian.org Wed Aug 2 13:06:00 2006 From: john at siberian.org (john at siberian.org) Date: Wed, 02 Aug 2006 10:06:00 -0700 Subject: [Restful-rails-general] Joins and REST Message-ID: <44d0db78.1a7.13a1c.650690470@siberian.org> Hi folks, Fairly new to RoR and Restful Rails but am really enjoying it. Here is probably a basic question but I'm not sure of the proper 'REST' way to go about it. Lets say I have a joined model, lets call it 'EXPENSEREPORT' and 'EXPENSES'. An EXPENSEREPORT has 0 or more EXPENSES (standard join scenario). With REST I know how to add an EXPENSEREPORT on its own and I can add an EXPENSE to an EXPENSEREPORT manually (posting to the controller for EXPENSE with the proper EXPENSEREPORT id in the XML) but that doesn't seem correct. My 'feeling' is that I should be able to 'PUT' to EXPENSEREPORT with 'EXPENSES' defined in the XML and have the EXPENSEREPORT 'PUT' handler identify this event and manage it properly. So maybe its more of a theological discussion, which method is correct, PUT to EXPENSEREPORT (thus updating the expense report but CREATING expenses?) or to individually POST to EXPENSES? And this may already all be in there, I just don't understand enough of what I am doing. Restful Rails is incredible, we took a 6 month dev effort and turned it into 4 weeks, just phenomenal. Thanks- John- From pic at superfluo.org Sat Aug 12 18:34:11 2006 From: pic at superfluo.org (Nicola Piccinini) Date: Sun, 13 Aug 2006 00:34:11 +0200 Subject: [Restful-rails-general] Joins and REST In-Reply-To: <44d0db78.1a7.13a1c.650690470@siberian.org> References: <44d0db78.1a7.13a1c.650690470@siberian.org> Message-ID: <44DE5763.3020306@superfluo.org> sorry, I'm new to RoR, RESTful Rails and REST too so I can't help. Maybe you could submit your questions to a more general mailing list, for example: http://groups.yahoo.com/group/rest-discuss/ Best regards. john at siberian.org wrote: > Hi folks, > Fairly new to RoR and Restful Rails but am really > enjoying it. Here is probably a basic question but I'm not > sure of the proper 'REST' way to go about it. > > Lets say I have a joined model, lets call it 'EXPENSEREPORT' > and 'EXPENSES'. An EXPENSEREPORT has 0 or more EXPENSES > (standard join scenario). > > With REST I know how to add an EXPENSEREPORT on its own and > I can add an EXPENSE to an EXPENSEREPORT manually (posting > to the controller for EXPENSE with the proper EXPENSEREPORT > id in the XML) but that doesn't seem correct. My 'feeling' > is that I should be able to 'PUT' to EXPENSEREPORT with > 'EXPENSES' defined in the XML and have the EXPENSEREPORT > 'PUT' handler identify this event and manage it properly. > > So maybe its more of a theological discussion, which method > is correct, PUT to EXPENSEREPORT (thus updating the expense > report but CREATING expenses?) or to individually POST to > EXPENSES? > > And this may already all be in there, I just don't > understand enough of what I am doing. > > Restful Rails is incredible, we took a 6 month dev effort > and turned it into 4 weeks, just phenomenal. > > Thanks- > John- > _______________________________________________ > Restful-rails-general mailing list > Restful-rails-general at rubyforge.org > http://rubyforge.org/mailman/listinfo/restful-rails-general > -- Nicola Piccinini -- http://superfluo.org From pic at superfluo.org Mon Aug 28 01:02:42 2006 From: pic at superfluo.org (Nicola Piccinini) Date: Mon, 28 Aug 2006 07:02:42 +0200 Subject: [Restful-rails-general] Accept header and cache In-Reply-To: <44C6A649.7000108@superfluo.org> References: <449C7A95.3070709@orcaware.com> <44A0D120.6030105@superfluo.org> <44A21B93.2070902@superfluo.org> <44A94E73.9080800@superfluo.org> <34F1E1D3-5188-4227-813D-FC9193DC08CD@autopilotmarketing.com> <44AF40E3.5090604@superfluo.org> <3257C57F-32EB-4687-A015-B2BF50BDA9FE@autopilotmarketing.com> <44C6A649.7000108@superfluo.org> Message-ID: <44F278F2.4090706@superfluo.org> > my fix is not a minimal patch because depends on your code for multi > values header and Vary header. > I think that is better to alert the developers to the potential problem, > referring to this thread in RESTful Rails mailing list for more > information. I'm going to do this as soon http://dev.rubyonrails.org/ > starts working again. see: http://dev.rubyonrails.org/ticket/5782 ciao -- Nicola Piccinini -- http://superfluo.org From pic at superfluo.org Mon Aug 28 01:10:57 2006 From: pic at superfluo.org (Nicola Piccinini) Date: Mon, 28 Aug 2006 07:10:57 +0200 Subject: [Restful-rails-general] HTTP::Authentication::Base Message-ID: <44F27AE1.1030301@superfluo.org> Hi, I put the HTTP::Authentication::Base module to work and I saw that currently the Digest authentication isn't supported. Consequently I've looked around searching for open source code to "borrow" and I've found, among the others, the htpasswd plugin: http://habtm.com/articles/2006/05/28/htpasswd-plugin After a quick survey, it seems to me that its classes and modules are the most adapt to reuse in RESTful Rails plugin. Do you think that it's worth to explore this possibility? Is there other plans for Digest Authentication support in RESTful Rails plugin? Thanks, best regards -- Nicola Piccinini -- http://superfluo.org From dan.kubb at autopilotmarketing.com Mon Aug 28 14:59:23 2006 From: dan.kubb at autopilotmarketing.com (Dan Kubb) Date: Mon, 28 Aug 2006 11:59:23 -0700 Subject: [Restful-rails-general] HTTP::Authentication::Base In-Reply-To: <44F27AE1.1030301@superfluo.org> References: <44F27AE1.1030301@superfluo.org> Message-ID: <4EC14450-B88A-47F3-A51F-16E0D8D67367@autopilotmarketing.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Nicola, > I put the HTTP::Authentication::Base module to work and I saw that > currently the Digest authentication isn't supported. Consequently I've > looked around searching for open source code to "borrow" and I've > found, > among the others, the htpasswd plugin: > http://habtm.com/articles/2006/05/28/htpasswd-plugin > > After a quick survey, it seems to me that its classes and modules are > the most adapt to reuse in RESTful Rails plugin. Do you think that > it's > worth to explore this possibility? Is there other plans for Digest > Authentication support in RESTful Rails plugin? I actually had planned to break HTTP::Authentication into a separate plugin to be used with any Rails application, not just one built on RESTful Rails. I was going to have a base authentication module, and then separate modules for Basic, Digest and (possibly) WSSE authentication for Atom feeds. I was then going to have a simple callback method where I could lookup the credentials in whatever storage format similar to how Coda Hale's simple_http_auth plugin works: http://blog.codahale.com/2006/05/11/basic-http-authentication-with- rails-simple_http_auth/ I was then going to have separate modules to abstract a few common storage methods, like htpasswd files or ActiveRecord objects. The idea being you could mix and match it to use Digest authentication with htpasswd storage on the backend. This is really similar to Apache's new AAA system, which has the best design I've seen. Nicola, if you or anyone else is interested in collaborating on an HTTP Auth plugin I'd be interested in working on it too. - -- Thanks, Dan __________________________________________________________________ Dan Kubb Autopilot Marketing Inc. Email: dan.kubb at autopilotmarketing.com Phone: 1 (604) 820-0212 Web: http://autopilotmarketing.com/ vCard: http://autopilotmarketing.com/~dan.kubb/vcard __________________________________________________________________ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (Darwin) iD8DBQFE8z0L4DfZD7OEWk0RAmtdAJ9qKzj5e3hK1rRdH90v8c311O7txACfTliv S4Sb9RkyiLLDWIhr0d3rgIs= =KDx9 -----END PGP SIGNATURE----- From pic at superfluo.org Wed Aug 30 02:45:03 2006 From: pic at superfluo.org (Nicola Piccinini) Date: Wed, 30 Aug 2006 08:45:03 +0200 Subject: [Restful-rails-general] HTTP::Authentication::Base In-Reply-To: <4EC14450-B88A-47F3-A51F-16E0D8D67367@autopilotmarketing.com> References: <44F27AE1.1030301@superfluo.org> <4EC14450-B88A-47F3-A51F-16E0D8D67367@autopilotmarketing.com> Message-ID: <44F533EF.5000908@superfluo.org> > I was going to have a base authentication module, and then separate > modules for Basic, Digest and (possibly) WSSE authentication for Atom > feeds. I was then going to have a simple callback method where I > could lookup the credentials in whatever storage format similar to > how Coda Hale's simple_http_auth plugin works: > > http://blog.codahale.com/2006/05/11/basic-http-authentication-with- > rails-simple_http_auth/ > > I was then going to have separate modules to abstract a few common > storage methods, like htpasswd files or ActiveRecord objects. as far as I can understand this is the same approach of the htpasswd plugin, they have authentication classes (currently for basic and digest authentication) and ACL callbacks for various storage format: /vendor/plugins/htpasswd/lib/htpasswd/acls$ ls active_record.rb crypted.rb htdigest.rb plain.rb base.rb digest.rb htpasswd.rb I don't know (haven't yet investigated) how much customizable are these acls. Best regards. -- Nicola Piccinini -- http://superfluo.org From blair at orcaware.com Wed Aug 30 20:09:19 2006 From: blair at orcaware.com (Blair Zajac) Date: Wed, 30 Aug 2006 17:09:19 -0700 Subject: [Restful-rails-general] Routes unit tests succeed with 1.1.6 and fail with RoR edge Message-ID: <44F628AF.5070101@orcaware.com> In needing some of the bug fixes in ActiveRecord for my project, I upgraded to RoR edge today. Most things worked fine, but my routing test suites are failing. I have a controller called shows and this are some of the errors I see: The generated path did not match <"/shows"> The generated path <"/show/by_id/1"> did not match <"/shows/1"> This is consistent with all my controllers. I'm using this code in my config/routes.rb ActionController::Routing::Routes.draw do |map| # Set up the routes for the REST URLs. requirements = { :action => /(?!\A(?:collection|by_id)\z)(?:[a-z](?:[-_]?[a-z])*)/, :timestamp => /\d+/ } [ 'folder', 'show', 'thumbnail' ].each do |controller| collection = controller.pluralize # This route matches URLs like '/folders'. map.connect "#{collection}/:action", :controller => controller, :action => 'collection', :requirements => requirements # This route matches URLs like '/folders/1' and # /folders/1/1150222800'. The timestamp in the second URL is used # for optimistic concurrency to prevent multiple updates or # deletes of a resource where the client may have an outdated # resource. map.connect "#{collection}/:id/:timestamp", :controller => controller, :action => 'by_id', :timestamp => nil, :requirements => requirements end end Before I spend more time on this, has anybody looked at the new routing code in RoR Edge and have fixes for restful_rails? Regards, Blair -- Blair Zajac, Ph.D. Subversion training, consulting and support http://www.orcaware.com/svn/