ActiveResource, how to add a param to every request?

Hi,

I have just created a couple of ActiveResource classes that are being used to communicate with a rest api.

In every request I am having to place an api key as an additional param e.g. @book = Book.find(params[:id], :params => {:key => '7348d92f82836eb9d5f69c0'})

Is anyone aware of a dry’er solution that will allow me define the additional param in the class below self.site or something similar?

Thanks, Scott

Maybe something like this (untested):

class Book < ActiveRecord::Base

   cattr_accessor :api_key

   def find(*args, &blk)         with_options(:key => class.api_key) do                 super         end   end

end

Then somewhere (in config?)

   Book.api_key = '7348d92f82836eb9d5f69c0'

Cool, Cheers Rick