# Linking to an external model/view within an application

**URL:** <https://www.ruby-forum.com/t/linking-to-an-external-model-view-within-an-application/161669>\
**Category:** Rails\
**Created:** [February 28, 2009, 8:33pm UTC](https://www.ruby-forum.com/t/linking-to-an-external-model-view-within-an-application/161669 "2009-02-28T20:33:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimmypalmer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jimmypalmer](https://www.ruby-forum.com/u/jimmypalmer)\
**Post date:** [February 28, 2009, 8:33pm UTC](https://www.ruby-forum.com/t/linking-to-an-external-model-view-within-an-application/161669/1 "2009-02-28T20:33:44Z")

</div>

Hey guys,

I am working on a class project and I have two scaffolded models,  
articles and sub\_articles. I have the relationships set to articles  
having many sub\_articles and sub\_articles belonging to articles, which  
is also stated in the routes file.

I am trying to display a link to each sub article when viewing a  
specific article, as it stands now I can display the link with the sub  
article title but it links back to the same article.

here are some code samples:

this is my sub article partial that shows the links,

- \<%= link\_to (sub\_article.title), h(sub\_article.id) %\>

how do i add the prefix sub\_articles/ to the id link?

also when I go to a url like /sub\_articles/1 I get an unknown action  
error, but I have a show.html.erb file

your help would be greatly appreciated, thank you all.

---

<div class="post-metadata">

**Author:** ![jimmypalmer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jimmypalmer](https://www.ruby-forum.com/u/jimmypalmer)\
**Post date:** [February 28, 2009, 9:18pm UTC](https://www.ruby-forum.com/t/linking-to-an-external-model-view-within-an-application/161669/2 "2009-02-28T21:18:04Z")

</div>

link\_to(sub\_article.title, sub\_article)

Rails knows the rest.

-eric

On Feb 28, 11:33 am, Jimmy P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![jimmypalmer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jimmypalmer](https://www.ruby-forum.com/u/jimmypalmer)\
**Post date:** [February 28, 2009, 9:23pm UTC](https://www.ruby-forum.com/t/linking-to-an-external-model-view-within-an-application/161669/3 "2009-02-28T21:23:49Z")

</div>

but that ends up with a link that looks like this in the browser

[http://localhost:3000/articles/1#\<SubArticle:0x597e8c0\>](http://localhost:3000/articles/1#%3CSubArticle:0x597e8c0%3E)

do i need to add something else where to make this work?
