# Activeresource: self.prefix = .../:id/... (need to set :id?)

**URL:** <https://www.ruby-forum.com/t/activeresource-self-prefix-id-need-to-set-id/146405>\
**Category:** Rails\
**Created:** [August 20, 2008, 5:28pm UTC](https://www.ruby-forum.com/t/activeresource-self-prefix-id-need-to-set-id/146405 "2008-08-20T17:28:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeanluca](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/74df32/32.png) [@jeanluca](https://www.ruby-forum.com/u/jeanluca)\
**Post date:** [August 20, 2008, 5:28pm UTC](https://www.ruby-forum.com/t/activeresource-self-prefix-id-need-to-set-id/146405/1 "2008-08-20T17:28:45Z")

</div>

Hi All

As I mentioned in my title I’m using activeresource and the model I’m  
using has the following prefix

self.prefix = ‘/institute/:institute\_id/services/:service\_id/’

All this is great, however I’m now in a situation where I need to save  
the model, but it translate the prefix as follows

/providers/983783784/services//appointments/234234234

So, the :service\_id is unknown and is not part of the prefix.

Here is the save command:

@myModel.save(:params =\> {:a =\> {:service =\> %w(mylink)}, :user\_id =\>  
current\_user.id})

I’m not an activeresource expert so I’m not really sure whats going on  
here.  
Is :a something activeresource understands (or maybe a hack of the  
application) ?

Furthermore, suppose I have the service\_id in a variable (@service\_id),  
how do I add this to this method ?  
I’ve tried things like:

@myModel.save(:params =\> {:a =\> {:service =\> %w(mylink)}, :user\_id =\>  
current\_user.id, :service\_id =\> 123})

but it didn’t fix it (I guess the stuff with the :a doesn’t work)

Thnx a lot  
Luca

ps: links to useful docs would be helpful too!!
