# ActiveResource RoutingError

**URL:** <https://www.ruby-forum.com/t/activeresource-routingerror/75610>\
**Category:** Rails\
**Created:** [November 11, 2006, 3:39pm UTC](https://www.ruby-forum.com/t/activeresource-routingerror/75610 "2006-11-11T15:39:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![scorpio\_leon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c2a13f/32.png) [@scorpio\_leon](https://www.ruby-forum.com/u/scorpio_leon)\
**Post date:** [November 11, 2006, 3:39pm UTC](https://www.ruby-forum.com/t/activeresource-routingerror/75610/1 "2006-11-11T15:39:29Z")

</div>

I have the following

- Edge Rails
- Initial ActiveResource Checkin

class Company \< ActiveResource::Base  
self.site = “[http://localhost:3000/](http://localhost:3000/)”  
end

this works  
c = Company.find(1)

when i try this

c.save

I get  
ActionController::RoutingError (no route found to match  
“/companies/.xml”  
with {  
:method=\>:put}):  
/vendor/rails/actionpack/lib/action\_controller/routing.rb:1250:in  
`recognize _path' /vendor/rails/actionpack/lib/action_controller/routing.rb:1240:in `recognize

The problem looks like an extra forward slash after companies, if so how  
can  
it?

Regards,  
Leon L.

–  
Never be afraid to try something new. Remember, amateurs built the ark;  
professionals built the Titanic!

---

<div class="post-metadata">

**Author:** ![scorpio\_leon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c2a13f/32.png) [@scorpio\_leon](https://www.ruby-forum.com/u/scorpio_leon)\
**Post date:** [November 11, 2006, 3:51pm UTC](https://www.ruby-forum.com/t/activeresource-routingerror/75610/2 "2006-11-11T15:51:31Z")

</div>

c.save works if it is an update

if it is a new record I get the above routingerror.

regards,  
Leon.

On 11/11/06, Leon L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> :method=\>:put}):  
> Leon L.
> 
> –  
> Never be afraid to try something new. Remember, amateurs built the ark;  
> professionals built the Titanic!

–  
Never be afraid to try something new. Remember, amateurs built the ark;  
professionals built the Titanic!

---

<div class="post-metadata">

**Author:** ![scorpio\_leon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c2a13f/32.png) [@scorpio\_leon](https://www.ruby-forum.com/u/scorpio_leon)\
**Post date:** [November 11, 2006, 4:27pm UTC](https://www.ruby-forum.com/t/activeresource-routingerror/75610/3 "2006-11-11T16:27:34Z")

</div>

changed /rails/activeresource/lib/active\_resource/base.rb line 83 to  
read

```
  def update
    id? ? connection.put(self.class.element_path(id), to_xml) :

```

connection.post(self.class.collection\_path, to\_xml)  
end

instead of

```
  def update
    connection.put(self.class.element_path(id), to_xml)
  end

```

and it works!!!

On 11/11/06, Leon L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > this works  
> > /vendor/rails/actionpack/lib/action\_controller/routing.rb:1250:in

–  
Never be afraid to try something new. Remember, amateurs built the ark;  
professionals built the Titanic!
