Hi All,
In app\views\home\Start.rhtml, the following code produces a list of
customer links:
<td>
<ul>
<% @customers.each do |c| %>
<li>
<!-- < %= link_to_customer(c) % > -->
<%= link_to(c.name,
:controller => ''customer'',
:action => ''show'',
:id => c.id)
%>
</li>
<% end %>
</ul>
</td>
But when I substitute:
<td>
<%= render :partial => customer/list %>
</td>
Rails complains:
undefined local variable or method ''customer''
I''ve got app\views\customer\_list.rhtml defined as:
<ul>
<% @customers.each do |c| %>
<li>
<%= link_to(c.name,
:controller => ''customer'',
:action => ''show'',
:id => c.id)
%>
</li>
<% end %>
</ul>
I''ve got _form, edit, etc. .rhtml files defined in that folder, as
well.
Can you tell why I can''t get the partial template to work?
Incidentally, I tried to use a helper function link_to_customer(c) in the
code above, but I disabled it because I couldn''t get that to work
either.
But I''ll save that issue for another day :-)
Thanks in Advance,
Richard
---
Env.: WinXP-Pro/SP2, MS VisualStudio.NET Eclipse 3.1.2
Ruby 1.8.2-15 Rails 1.1.4 Java JDK 1.5.0_06
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---
-----Original Message-----
From: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
[mailto:rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org]On Behalf Of
Richard Lionheart
Sent: Monday, September 11, 2006 6:11 PM
To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: [Rails] Hookup to partial template fails - Why?
Hi All,
In app\views\home\Start.rhtml, the following code produces a list of
customer links:
<td>
<ul>
<% @customers.each do |c| %>
<li>
<!-- < %= link_to_customer(c) % > -->
<%= link_to(c.name,
:controller => ''customer'',
:action => ''show'',
:id => c.id)
%>
</li>
<% end %>
</ul>
</td>
But when I substitute:
<td>
<%= render :partial => customer/list %>
</td>
Rails complains:
undefined local variable or method ''customer''
**********************
I think you need the partial name in single-quotes...e.g.
''customer/list''
Nathan
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@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
-~----------~----~----~----~------~----~------~--~---
You have: <%= render :partial => customer/list %> I think you need: <%= render :partial => "customer/list" %> Terry On 9/11/06, Richard Lionheart <RichardDummyMailbox58407-gP6xRNRnnqSxhq/XJNNIW0EOCMrvLtNR@public.gmane.org> wrote:> > > Hi All, > > In app\views\home\Start.rhtml, the following code produces a list of > customer links: > > <td> > <ul> > <% @customers.each do |c| %> > <li> > <!-- < %= link_to_customer(c) % > --> > <%= link_to(c.name, > :controller => ''customer'', > :action => ''show'', > :id => c.id) > %> > </li> > <% end %> > </ul> > </td> > > But when I substitute: > > <td> > <%= render :partial => customer/list %> > </td> > > Rails complains: > undefined local variable or method ''customer'' > > I''ve got app\views\customer\_list.rhtml defined as: > > <ul> > <% @customers.each do |c| %> > <li> > <%= link_to(c.name, > :controller => ''customer'', > :action => ''show'', > :id => c.id) > %> > </li> > <% end %> > </ul> > > I''ve got _form, edit, etc. .rhtml files defined in that folder, as well. > > Can you tell why I can''t get the partial template to work? > > Incidentally, I tried to use a helper function link_to_customer(c) in the > code above, but I disabled it because I couldn''t get that to work either. > But I''ll save that issue for another day :-) > > Thanks in Advance, > Richard > --- > Env.: WinXP-Pro/SP2, MS VisualStudio.NET Eclipse 3.1.2 > Ruby 1.8.2-15 Rails 1.1.4 Java JDK 1.5.0_06 > > > > > > >-- Terry (TAD) Donaghe http://www.tadspot.com http://www.rubynoob.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Hi Terry and Nathan,> ''customer/list''That did it!! I spent a day trying to figure out the cause of my problem. You guys solved it in an instant! Thank you very much. Regards, Richard "Richard Lionheart" <RichardDummyMailbox58407-FtJgd9dCuO3JTKoYRCtP1UEOCMrvLtNR@public.gmane.org> wrote in message news:ee4qe2$drn$1@sea.gmane.org... --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---