Hi All, I''ve got a bunch of views for Vendors and Users, e.g. app\views\vendors \index.html.erb: <h1>Listing vendors</h1> <div id="menu"> <%= link_to ''Vendor'', :controller=>''vendors'', :action=>''index'' %> <%= link_to ''User'', :controller=>''users'', :action=>''index'' %> </div <br/> <table> <tr> <th>Nickname</th> <th>Qbname</th> </tr> <% @vendors.each do |vendor| %> <tr> <td><%=h vendor.nickname %></td> [snip] I pasted the div "menu" into all the views. When I change that menu, I''ve got to change all of them. Pretty bad, eh? I''ve also got that menu in app\views\layouts\menu.html.erb. Can I replace the div I pasted in manually with some kind of "include" referencing that .erb? I tried a bunch of ways to no avail. Thanks in Advance, Richard -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Mon, 2010-03-08 at 16:20 -0800, RichardOnRails wrote:> Hi All, > > I''ve got a bunch of views for Vendors and Users, e.g. app\views\vendors > \index.html.erb: > > <h1>Listing vendors</h1> > > <div id="menu"> > <%= link_to ''Vendor'', :controller=>''vendors'', > :action=>''index'' %> > <%= link_to ''User'', :controller=>''users'', > :action=>''index'' %> > </div > <br/> > > <table> > <tr> > <th>Nickname</th> > <th>Qbname</th> > </tr> > > <% @vendors.each do |vendor| %> > <tr> > <td><%=h vendor.nickname %></td> > > [snip] > > I pasted the div "menu" into all the views. When I change that menu, > I''ve got to change all of them. Pretty bad, eh? > > I''ve also got that menu in app\views\layouts\menu.html.erb. > > Can I replace the div I pasted in manually with some kind of "include" > referencing that .erb? I tried a bunch of ways to no avail.---- http://api.rubyonrails.org/classes/ActionView/Base.html you need to use ''templates'' but this is rather elemental and suggests that you need to check out more basic tutorials or possibly AWDWROR (Agile Web Development With Ruby on Rails) Craig -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi Craig, Thanks for your response.> you need to use ''templates'' but this is rather elementalYou''re spot on. This is my first "real" Rails app (for my son who runs a couple of private schools). So I''d like to get this working in a timely but correctly implement fashion. Following your link, I modified my working module app\views\vendors \index.html.erb as follows h1>Listing vendors</h1> <div id="menu"> <%= link_to ''Vendor'', :controller=>''vendors'', :action=>''index'' %> <%= link_to ''User'', :controller=>''users'', :action=>''index'' %> </div <br/> <%= render "shared/menu" %> <br/> [snip] I left in my working menu div and hoping my menu.html.erb or menu.erb files in app\views\shared will be invoked. Sadly, I got: ActionView::MissingTemplate in Vendors#index Showing app/views/vendors/index.html.erb where line #11 raised: Missing template shared/_menu.erb in view path app/views Extracted source (around line #11): 8: </div 9: <br/> 10: 11: <%= render "shared/menu" %> 12: 13: <table> 14: <tr> Can you spot where I erred? Again, thanks in advance for any guidance you may offer. Best wishes, Richard On Mar 8, 7:56 pm, Craig White <craigwh...-BQ75lA0ptkhBDgjK7y7TUQ@public.gmane.org> wrote:> On Mon, 2010-03-08 at 16:20 -0800, RichardOnRails wrote: > > Hi All, > > > I''ve got a bunch of views for Vendors and Users, e.g. app\views\vendors > > \index.html.erb: > > > <h1>Listing vendors</h1> > > > <div id="menu"> > > <%= link_to ''Vendor'', :controller=>''vendors'', > > :action=>''index'' %> > > <%= link_to ''User'', :controller=>''users'', > > :action=>''index'' %> > > </div > > <br/> > > > <table> > > <tr> > > <th>Nickname</th> > > <th>Qbname</th> > > </tr> > > > <% @vendors.each do |vendor| %> > > <tr> > > <td><%=h vendor.nickname %></td> > > > [snip] > > > I pasted the div "menu" into all the views. When I change that menu, > > I''ve got to change all of them. Pretty bad, eh? > > > I''ve also got that menu in app\views\layouts\menu.html.erb. > > > Can I replace the div I pasted in manually with some kind of "include" > > referencing that .erb? I tried a bunch of ways to no avail. > > ----http://api.rubyonrails.org/classes/ActionView/Base.html > > you need to use ''templates'' but this is rather elemental and suggests > that you need to check out more basic tutorials or possibly AWDWROR > (Agile Web Development With Ruby on Rails) > > Craig > > -- > This message has been scanned for viruses and > dangerous content by MailScanner, and is > believed to be clean.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thanks again, Craig. I saw and understood and tried to respond to that message. Following is the a session in a Command Window on my Win-XP/SP3 system that seem to provide the alleged missing code: K:\_Projects\Ruby\_Rails_Apps\_EIMS\RTS>cd app\views\shared K:\_Projects\Ruby\_Rails_Apps\_EIMS\RTS\app\views\shared>dir Volume in drive K is K02-100G_NT Volume Serial Number is B00C-F65F Directory of K:\_Projects\Ruby\_Rails_Apps\_EIMS\RTS\app\views\shared 03/08/2010 09:48 PM <DIR> . 03/08/2010 09:48 PM <DIR> .. 03/08/2010 12:54 PM 210 menu.erb 03/08/2010 12:54 PM 210 menu.html.erb 2 File(s) 420 bytes 2 Dir(s) 58,907,955,200 bytes free K:\_Projects\Ruby\_Rails_Apps\_EIMS\RTS\app\views\shared>type menu.erb <%= link_to ''Vendor'', :controller=>''vendors'', :action=>''index'' %> <%= link_to ''User'', :controller=>''users'', :action=>''index'' %> K:\_Projects\Ruby\_Rails_Apps\_EIMS\RTS\app\views\shared>type menu.html.erb <%= link_to ''Vendor'', :controller=>''vendors'', :action=>''index'' %> <%= link_to ''User'', :controller=>''users'', :action=>''index'' %> K:\_Projects\Ruby\_Rails_Apps\_EIMS\RTS\app\views\shared> I know the message said "menu.erb" but I thought it might not be up-to- date with Rails 2.3.5, which I running, along with Ruby 1.8.6. If you''re up to another look at this, I''d be in your debt. Best wishes, Richard On Mar 8, 10:06 pm, Craig White <craigwh...-BQ75lA0ptkhBDgjK7y7TUQ@public.gmane.org> wrote:> On Mon, 2010-03-08 at 18:52 -0800, RichardOnRails wrote: > > Hi Craig, > > > Thanks for your response. > > > > you need to use ''templates'' but this is rather elemental > > > You''re spot on. This is my first "real" Rails app (for my son who > > runs a couple of private schools). So I''d like to get this working in > > a timely but correctly implement fashion. > > > Following your link, I modified my working module app\views\vendors > > \index.html.erb as follows > > > h1>Listing vendors</h1> > > > <div id="menu"> > > <%= link_to ''Vendor'', :controller=>''vendors'', > > :action=>''index'' %> > > <%= link_to ''User'', :controller=>''users'', > > :action=>''index'' %> > > </div > > <br/> > > > <%= render "shared/menu" %> > > <br/> > > [snip] > > > I left in my working menu div and hoping my menu.html.erb or menu.erb > > files in app\views\shared will be invoked. > > > Sadly, I got: > > ActionView::MissingTemplate in Vendors#index > > > Showing app/views/vendors/index.html.erb where line #11 raised: > > > Missing template shared/_menu.erb in view path app/views > > > Extracted source (around line #11): > > > 8: </div > > 9: <br/> > > 10: > > 11: <%= render "shared/menu" %> > > 12: > > 13: <table> > > 14: <tr> > > > Can you spot where I erred? > > > Again, thanks in advance for any guidance you may offer. > > > Best wishes, > > Richard > > > On Mar 8, 7:56 pm, Craig White <craigwh...-BQ75lA0ptkhBDgjK7y7TUQ@public.gmane.org> wrote: > > > On Mon, 2010-03-08 at 16:20 -0800, RichardOnRails wrote: > > > > Hi All, > > > > > I''ve got a bunch of views for Vendors and Users, e.g. app\views\vendors > > > > \index.html.erb: > > > > > <h1>Listing vendors</h1> > > > > > <div id="menu"> > > > > <%= link_to ''Vendor'', :controller=>''vendors'', > > > > :action=>''index'' %> > > > > <%= link_to ''User'', :controller=>''users'', > > > > :action=>''index'' %> > > > > </div > > > > <br/> > > > > > <table> > > > > <tr> > > > > <th>Nickname</th> > > > > <th>Qbname</th> > > > > </tr> > > > > > <% @vendors.each do |vendor| %> > > > > <tr> > > > > <td><%=h vendor.nickname %></td> > > > > > [snip] > > > > > I pasted the div "menu" into all the views. When I change that menu, > > > > I''ve got to change all of them. Pretty bad, eh? > > > > > I''ve also got that menu in app\views\layouts\menu.html.erb. > > > > > Can I replace the div I pasted in manually with some kind of "include" > > > > referencing that .erb? I tried a bunch of ways to no avail. > > > > ----http://api.rubyonrails.org/classes/ActionView/Base.html > > > > you need to use ''templates'' but this is rather elemental and suggests > > > that you need to check out more basic tutorials or possibly AWDWROR > > > (Agile Web Development With Ruby on Rails) > > ---- > it''s telling you exactly what the problem is... > > Missing template shared/_menu.erb in view path app/views > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > Craig > > -- > This message has been scanned for viruses and > dangerous content by MailScanner, and is > believed to be clean.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
OK Craig, I got it: I missed the _ in the name. Problem solved. Thank you very much for your help. Best wishes, Richard On Mar 8, 10:06 pm, Craig White <craigwh...-BQ75lA0ptkhBDgjK7y7TUQ@public.gmane.org> wrote:> On Mon, 2010-03-08 at 18:52 -0800, RichardOnRails wrote: > > Hi Craig, > > > Thanks for your response. > > > > you need to use ''templates'' but this is rather elemental > > > You''re spot on. This is my first "real" Rails app (for my son who > > runs a couple of private schools). So I''d like to get this working in > > a timely but correctly implement fashion. > > > Following your link, I modified my working module app\views\vendors > > \index.html.erb as follows > > > h1>Listing vendors</h1> > > > <div id="menu"> > > <%= link_to ''Vendor'', :controller=>''vendors'', > > :action=>''index'' %> > > <%= link_to ''User'', :controller=>''users'', > > :action=>''index'' %> > > </div > > <br/> > > > <%= render "shared/menu" %> > > <br/> > > [snip] > > > I left in my working menu div and hoping my menu.html.erb or menu.erb > > files in app\views\shared will be invoked. > > > Sadly, I got: > > ActionView::MissingTemplate in Vendors#index > > > Showing app/views/vendors/index.html.erb where line #11 raised: > > > Missing template shared/_menu.erb in view path app/views > > > Extracted source (around line #11): > > > 8: </div > > 9: <br/> > > 10: > > 11: <%= render "shared/menu" %> > > 12: > > 13: <table> > > 14: <tr> > > > Can you spot where I erred? > > > Again, thanks in advance for any guidance you may offer. > > > Best wishes, > > Richard > > > On Mar 8, 7:56 pm, Craig White <craigwh...-BQ75lA0ptkhBDgjK7y7TUQ@public.gmane.org> wrote: > > > On Mon, 2010-03-08 at 16:20 -0800, RichardOnRails wrote: > > > > Hi All, > > > > > I''ve got a bunch of views for Vendors and Users, e.g. app\views\vendors > > > > \index.html.erb: > > > > > <h1>Listing vendors</h1> > > > > > <div id="menu"> > > > > <%= link_to ''Vendor'', :controller=>''vendors'', > > > > :action=>''index'' %> > > > > <%= link_to ''User'', :controller=>''users'', > > > > :action=>''index'' %> > > > > </div > > > > <br/> > > > > > <table> > > > > <tr> > > > > <th>Nickname</th> > > > > <th>Qbname</th> > > > > </tr> > > > > > <% @vendors.each do |vendor| %> > > > > <tr> > > > > <td><%=h vendor.nickname %></td> > > > > > [snip] > > > > > I pasted the div "menu" into all the views. When I change that menu, > > > > I''ve got to change all of them. Pretty bad, eh? > > > > > I''ve also got that menu in app\views\layouts\menu.html.erb. > > > > > Can I replace the div I pasted in manually with some kind of "include" > > > > referencing that .erb? I tried a bunch of ways to no avail. > > > > ----http://api.rubyonrails.org/classes/ActionView/Base.html > > > > you need to use ''templates'' but this is rather elemental and suggests > > > that you need to check out more basic tutorials or possibly AWDWROR > > > (Agile Web Development With Ruby on Rails) > > ---- > it''s telling you exactly what the problem is... > > Missing template shared/_menu.erb in view path app/views > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > Craig > > -- > This message has been scanned for viruses and > dangerous content by MailScanner, and is > believed to be clean.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.