[Rails] Question about link_to

2011-08-06 Thread Pepe Sanchez
Hi all

I am working on the first  application from the book Head First Rails
called tickets. What I do not understand is where the variable
new_ticket_path gets populated in the view index.html.erb


%= link_to 'New Ticket', new_ticket_path %

Please advise

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Question about link_to

2011-08-06 Thread Walter Lee Davis

On Aug 6, 2011, at 12:46 PM, Pepe Sanchez wrote:


Hi all

I am working on the first  application from the book Head First  
Rails

called tickets. What I do not understand is where the variable
new_ticket_path gets populated in the view index.html.erb


%= link_to 'New Ticket', new_ticket_path %

Please advise



This path is made up by the rails router. If you have  
'resources :tickets' in your routes file, then this path is generated  
automatically for you. Type rake routes in your Terminal to see the  
whole lot of them.


There's an excellent Rails Guide about this, called Routing from the  
Outside In.


Walter




--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.