Okay, another pretty obvious beginner question

So this is another obvious question, but if you’re referring to
something using Erb, such as <%[email protected]%>, and you need to put
that into a link_to tag, how would you do it?

I have:
<%= link_to(post.title, :action=>‘show’, :id=>post%>

But that doesn’t seem to work. Thoughts?

Thanks,

Ron

This should work:

<%= link_to(@page.title, :action=>‘show’, :id=>post%>

On Thu, Mar 6, 2008 at 2:31 PM, Ron [email protected] wrote:

Thanks,

Ron


Henry
http://www.henrywagner.org/

That did wind up working. Thanks, Henry!

Ron

On Mar 6, 2008, at 2:31 PM, Ron wrote:

I have:
<%= link_to(post.title, :action=>‘show’, :id=>post%>

But that doesn’t seem to work. Thoughts?

Ron, I know you have your question answered, but in the future if you
provide more specifics than “doesn’t seem to work,” you can get better
help. If it’s breaking, a stack trace might be in order.

Also, a little more context is useful. For example, telling us you set
@page in your controller or something like that.

I think that will make your feedback from the community quicker and
more accurate.

Hi s.ross,

That’s a very good point. I should have been more clear. My
controller has for this action the following:

def list
@post_pages, @posts = paginate :posts, :per_page => 10
@pages=Page.find(:all)
@events=Event.find(:all)
end

I wound up modifying Henry’s suggestion to:
<%= link_to post.title, :action=>‘show’, :id=>post%>

There was just a problem with the parenthesis.

Ron

Great, glad to help.

Henry
On Thu, Mar 6, 2008 at 3:12 PM, Ron [email protected] wrote:

But that doesn’t seem to work. Thoughts?

Thanks,

Ron


Henryhttp://www.henrywagner.org/


Henry
http://www.henrywagner.org/