Mr Colin, When I looked for the full path and filenames for the views to give to you, I saw that the shownames filename was incorrect: ~/views/ serv_instit/_shownames.html.erb. Before I was trying to use a partial... Then I changed the filename to /shownames.html.erb and the application worked!! Thank you, very very much!
On 9 jul, 16:51, Colin Law <[email protected]> wrote: > On 9 July 2010 18:24, LuisRuby <[email protected]> wrote: > > > > > Hello friends! > > I have an application to list different kinds of institution names. So > > I have one table "instits" for the institutions and another table > > "nome_instits" for their names. For test, I put two rows inside > > "instits" and three names for the first institution and two names for > > the last. Then I created this controller: > > > class ServInstitController < ApplicationController > > > def index > > �...@instit = Instit.find(:all, :order => 'created_at asc') > > end > > > def shownames > > instit_ident = params[:instit_id] > > �...@nomesinstit = NomeInstit.find_all_by_instit_id(instit_ident) > > end > > > end > > > And I created this view "index": > > > <h3>Serviços relacionados à instituições</h3> > > <br /> > > <% if @instit.nil? == false and @instit.length > 0 %> > > <table> > > <tr> > > <th>ID</th> > > <th>Descrição</th> > > <th>Nome</th> > > <th></th> > > </tr> > > > <% @instit.each do |instit| %> > > <tr> > > <td><%=h instit.id %></td> > > <td><%=h instit.descricao %></td> > > <td><%=h NomeInstit.find(:first, :conditions => > > ["instit_id= ?", instit.id]).descricao %></td> > > <td><%= link_to 'Ver outros > > nomes', :action=> :shownames, :instit_id => instit.id %></td> > > </tr> > > <% end %> > > > </table> > > <% else %> > > <i>Nenhuma instituição encontrada!</i> > > <% end %> > > <br /> > > <%= link_to 'Voltar', :controller => :pp_administracao %> > > > So I created this view "shownames": > > > <table> > > <tr> > > <th>ID</th> > > <th>Descrição</th> > > <th>Nome</th> > > </tr> > > > <% @nomesinstit.each do |nomesinstit| %> > > <tr> > > <td><%=h nomesinstit.id %></td> > > <td><%=h nomesinstit.descricao %></td> > > </tr> > > <% end %> > > > </table> > > > <br/><br/> > > <%= link_to 'Voltar', :controller => :serv_instit, :action => :index > > %> > > > Well. Then I can see the following screen: > > ID > > Descrição > > Nome > > 1 Instituição onde está instalado este SIGAD > > FUB Ver outros nomes > > 3 Órgão do Governo responsável pelas universidades > > MEC Ver outros nomes > > > Voltar > > > When I, for example, put the mouse pointer over the second "Ver outros > > nomes", I can see this generated url: > > >http://localhost:3000/serv_instit/shownames?instit_id=3 > > > Hmmm, I don't know if this is a valid url. "instit_id" is the foreign > > key in the table "nome_instits" pointing to the correct row in the > > table "instits", and the value "3" is correct. When I click over there > > I get this error: > > The ?instit_id=3 is there because in the link you have specified > :instit_id => instit.id thereby requesting instit_id to be included as > a parameter > > > > > Template is missing > > > Missing template serv_instit/shownames with > > {:handlers=>[:rxml, :builder, :erb, :rjs, :rhtml], :formats=>[:html], > > :locale=>[:en, :en]} > > in view paths "/home/luiz/work/sigad3/app/views", "/home/luiz/work/ > > sigad3/vendor/plugins/jrails/app/views", "/usr/lib/ruby/gems/1.8/gems/ > > devise-1.1.rc1/app/views" > > The fact that it is complaining about a missing template suggests that > it has successfully gone to the shownames action and is trying to > render the result. Maybe you have an error in the path or filename > for the view file. Can you supply the full path and filenames for the > controller and view files please? > > Colin > > > > > I tried insert these rows in the routes file, but it didn't work: > > > resources :serv_instits > > > get "serv_instit/shownames" > > > get "serv_instit/index" -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

