Ruby on rails link_to syntax

Posted by mizipzor on Stack Overflow See other posts from Stack Overflow or by mizipzor
Published on 2009-02-13T13:38:34Z Indexed on 2010/06/06 7:42 UTC
Read the original article Hit count: 458

After following a tutorial Ive found. Im now redoing it again, without the scaffolding part, to learn it better.

However, editing my \app\views\home\index.html.erb to contain:

<h1>Rails test project</h1>
<%= link_to "my blog", posts_path>

I get an error:

undefined local variable or method `posts_path' for #<ActionView::Base:0x4e1d954>

Before I did this, I ran rake db:create, defined a migration class and ran rake db:migrate, everything without a problem.

So the database should contain a posts table. But that link_to command cant seem to find posts_path. That variable (or is it even a function?) is probably defined through the scaffold routine.

My question now is; how do I do that manually myself, define posts_path?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about scaffolding