Ruby on Rails Tuesday, January 4, 2011

So, how exactly do i set a unique headers for each individual request?

Here is the implementation from the ActiveResource code:

def update
connection.put(element_path(prefix_options), encode,
self.class.headers).tap do |response|
load_attributes_from_response(response)
end
end


As you can see it does not respect the headers set on the object,
instead it always reads the headers from the class

Am I getting it wrong?


Dmitry

On Jan 4, 10:50 am, Hassan Schroeder <hassan.schroe...@gmail.com>
wrote:
> On Tue, Jan 4, 2011 at 7:20 AM, dmitry <dmitry...@gmail.com> wrote:
> > Does active resource support setting headers on the model object
> > rather then on the model class?
> > That would solve the issue, but looking thought the active resource
> > code does not seem that it's available.
>
> > Any good reason why should the option of setting headers per object
> > not be supported/provided/available?
>
> (Rails 3.0.3) ActiveResource::Connection lists
>
>   get(path, headers = {})
>
> as a public instance method; is that not what you want? ('headers' is
> also part of other ReSTful verbs e.g. put/post/etc. method signatures)
>
> --
> Hassan Schroeder ------------------------ hassan.schroe...@gmail.com
> twitter: @hassan

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment