On 23 Sep 2008, at 12:15, FM wrote:

>
>
>
> On Sep 23, 11:44 am, Frederick Cheung <[EMAIL PROTECTED]>
> wrote:
>>
>> I think you could tidy this up a little - There is a way of telling
>> rails 'if the content-type is x then use this to parse the request
>> parameters'
>>
>> You just do something along the lines of
>>
>> ActionController::Base.param_parsers[some_mime_type] = Proc.new do |
>> data|
>>   # do something with data and turn it into a hash
>> end
>>
> Thank you for the hint.
> It works!
>
>
> ... but now I have another question :)
> Is it possible to set this behavior on a per-controller basis?

Probably not - the method I gave is intended to be entirely general

Fred


>
> What I mean is that I would like to parse atom only in the context of
> some specific controllers.
>
> So I tried this:
>
> class MyResourceController < ApplicationController
>  @@param_parsers[Mime::ATOM] = lambda do |body|
>     ...do the processing here to translate the atom entry to an hash
> matching my resource's model
>  end
>
>  ...
> end
>
> but it doesn't work.
>
> Thanks again for your help.
>
> -FM
> >


--~--~---------~--~----~------------~-------~--~----~
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