Hi there,
I had a go at this, and managed to get it working. I'll probably
provide a plugin sometime in near future.
Stefan
On Nov 21, 5:24 pm, patrick aljord <[EMAIL PROTECTED]> wrote:
> On Nov 19, 1:02 pm, "Stefan Magnus Landrø" <[EMAIL PROTECTED]>
> wrote:
>
> > How would you expose this functionality through a REST interface in
> > rails? To me it seems like ARes only supports CRUD-style operations -
> > where you can only get one or more table rows etc.
>
> You could do something like this:
>
> # GET /people/count.xml
> def count
> @count = Person.count(:all)
>
> respond_to do |format|
> format.xml { render :xml => "<?xml version=\"1.0\" encoding=
> \"UTF-8\"?>\n<count>[EMAIL PROTECTED]</count>" }
> end
> end
>
> and then in your routes:
> p.resources :people , :collection => { :count => :get }
>
> There's probably a better solution but that should work.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Core" 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-core?hl=en
-~----------~----~----~----~------~----~------~--~---