Topic: undefined local variable or method 'posts_path'
I was trying to follow the tutorial instructions on http://guides.rubyonrails.org/getting_started.html Everything went fine til I came to section
"6.2 Adding a Link
To hook the posts up to the home page you’ve already created, you can add a link to the home page. Open app/views/home/index.html.erb and modify it as follows:
(h1)Hello, Rails!(/h1)
(%= link_to "My Blog", posts_path %)
The link_to method is one of Rails’ built-in view helpers. It creates a hyperlink based on text to display and where to go – in this case, to the path for posts."
(angle brackets replaced by normal brackets for the sake of the forum)
The result I get looks as follows:
"NameError in Home#index
Showing c:/Users/paulousek/My Documents/Aptana Studio 3 Workspace/TestAptanaRails/blog/app/views/home/index.html.erb where line #2 raised:
undefined local variable or method `posts_path' for #<#<Class:0x379c800>:0x2f5c080>
Extracted source (around line #2):
1: (h1)Home#index(/h1)
2: (%= link_to "My Blog", posts_path %)"
So what is missing or wrong here??
Last edited by PPPaul (2012-10-09 13:11:06)