# Long arsd problem

**URL:** <https://www.ruby-forum.com/t/long-arsd-problem/172266>\
**Category:** Rails\
**Created:** [July 18, 2009, 1:46am UTC](https://www.ruby-forum.com/t/long-arsd-problem/172266 "2009-07-18T01:46:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmaenpaa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9de053/32.png) [@jmaenpaa](https://www.ruby-forum.com/u/jmaenpaa)\
**Post date:** [July 18, 2009, 1:46am UTC](https://www.ruby-forum.com/t/long-arsd-problem/172266/1 "2009-07-18T01:46:36Z")

</div>

hi,

This might be really obvious to someone, but this is doing my head in,  
however I am a noob so any help would be appreciated.

this is my routes.rb file:  
map.resources :comments  
map.resources :posts  
map.connect :logs

I have two controllers, one is called Posts (which I generated using a  
scaffold) and the other is called logs-- I just created a controller for  
this.

logs controller:

def index  
@logs = (Post.all)  
end

def show  
@log = Post.find(params[:id])  
end

Now my problem is this:

index.html in logs folder:

\<%= link\_to 'read more...', log%\>

I want this to link to link to log/:id (e.g. logs/1) when they click on  
the first post, however it keeps going to posts/:id (e.g. posts/1)

Sorry about the long question, I’m trying to give as much information as  
possible, any help would be appreciated.

Cheers

---

<div class="post-metadata">

**Author:** ![jmaenpaa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9de053/32.png) [@jmaenpaa](https://www.ruby-forum.com/u/jmaenpaa)\
**Post date:** [July 18, 2009, 10:33am UTC](https://www.ruby-forum.com/t/long-arsd-problem/172266/2 "2009-07-18T10:33:20Z")

</div>

Hey John,

Rails figures out that your ‘log’ object in your view is, in truth, a  
Post  
object. As such the url it generates is equivalent to post\_path(log).

You’ll want to edit your index template as follows:

\<%= link\_to 'read more...', log\_path(log) %\>

Regards,  
Gustav P.

On Sat, Jul 18, 2009 at 1:46 AM, John M. \<

---

<div class="post-metadata">

**Author:** ![jmaenpaa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9de053/32.png) [@jmaenpaa](https://www.ruby-forum.com/u/jmaenpaa)\
**Post date:** [July 18, 2009, 4:16pm UTC](https://www.ruby-forum.com/t/long-arsd-problem/172266/3 "2009-07-18T16:16:55Z")

</div>

Thank you very very much!
