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:
<p><%= link_to 'read more...', log_path(log) %></p>

Regards,
Gustav Paul

On Sat, Jul 18, 2009 at 1:46 AM, John Mossel <
[email protected]> wrote:

>
> 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:
> <p><%= link_to 'read more...', log%></p>
>
> 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
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to