I have created a blog by following the instructions detailed in the
now-famous blog screencast. Now, I''m attempting to increase my
knowledge of Rails by accomplishing that same feat in a more hands-on
way (i.e., without a scaffold). One perplexing issue that I have
encountered is that when I created the blog using a scaffold the
various template files that were created contained several instances
of mysterious code that looked similar to this:
<%= link_to ''Back'', posts_path %>
and this:
<%= link_to ''Edit'', edit_post_path(@post) %>
In the above, ''posts_path'' and
''edit_post_path'' appear to be methods;
but, I can''t find where these methods are defined. If I insert
similar code into the blog that I created without a scaffold, Rails
complains about a missing method. Can someone please explain what the
story is on the mysterious methods?
Thanks for any input.
... doug
Doug Jolley wrote: [...]> In the above, ''posts_path'' and ''edit_post_path'' appear to be methods; > but, I can''t find where these methods are defined.[...] They are defined by your named routes. Read the routing docs and run "rake routes" to see what you''ve got. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/.
Try this for starters... http://guides.rubyonrails.org/routing.html Rick On Jun 11, 8:49 pm, doug <ddjol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have created a blog by following the instructions detailed in the > now-famous blog screencast. Now, I''m attempting to increase my > knowledge of Rails by accomplishing that same feat in a more hands-on > way (i.e., without a scaffold). One perplexing issue that I have > encountered is that when I created the blog using a scaffold the > various template files that were created contained several instances > of mysterious code that looked similar to this: > > <%= link_to ''Back'', posts_path %> > > and this: > > <%= link_to ''Edit'', edit_post_path(@post) %> > > In the above, ''posts_path'' and ''edit_post_path'' appear to be methods; > but, I can''t find where these methods are defined. If I insert > similar code into the blog that I created without a scaffold, Rails > complains about a missing method. Can someone please explain what the > story is on the mysterious methods? > > Thanks for any input. > > ... doug