You probably want to see my partial

- results.html.erb -

<table>
      <tr>
        <th colspan="5">Project</th>
      </tr>
      <tr>
        <th>Project ID</th>
        <th>IRB ID</th>
        <th>Title</th>
        <th>Pi full name</th>
        <th>Action</th>
      </tr>
      <% @projects.each do |project| %>
      <tr>
          <td><%=h project.irb_id %></td>
          <td><%=h project.project_id %></td>
          <td><%=h project.title %></td>
          <td><%=h project.pi_full_name %></td>
          <td style="text-align:center;"><%= link_to 'view', project, 
:rel => 'facebox' %></td>
        </tr>
      <% end %>
  </table>

John

John Mcleod wrote:
> Aldric,
> I did what you suggested and still haven't displayed anything.  I am 
> however getting results per Firebug, but no display.
> Here's my model and controller again.
> 
> - Model -
> def self.search_by_irb_pi(search, page)
> 
>      paginate( :per_page => 10, :page => page,
>              :conditions => ['irb_id LIKE ?', "%#{search}%"],
>              :order => 'irb_id ASC')
> end
> 
> - Controller -
> def search
>     irb_id = params[:id]
>     results = Project.search_by_irb_pi(irb_id, params[:page])
>     render :partial => 'imports/results', :locals => {:projects => 
> @projects}
> end
> 
> Thank you again for all your help
> 
> John
> 
> Aldric Giacomoni wrote:
>> John Mcleod wrote:
>>> Aldric,
>>> Sorry, I just did some work on the project and it still doesn't update 
>>> the searchResults table.
>>> 
>> 
>>>               <td><%= link_to_remote "Find Matches", :update => 
>>> "search_results", :url => {:controller => 'projects', :action => 
>>> 'search', :id => import.irb_id }  %></td>
>>> 
>>> 
>>>   <div class="search_results">
>>>     <table>
>>>       <tr>
>>>         <th colspan="5">Search Results</th>
>>>       </tr>
>>>       <tr>
>>>         <th>Project ID</th>
>>>         <th>IRB ID</th>
>>>         <th>Title</th>
>>>         <th>Pi full name</th>
>>>         <th>Action</th>
>>>       </tr>
>>> 
>>>       <% @projects.each do |project| %>
>>>       <tr>
>>>           <td><%=h project.irb_id %></td>
>>>           <td><%=h project.project_id %></td>
>>>           <td><%=h project.title %></td>
>>>           <td><%=h project.pi_full_name %></td>
>>>           <td style="text-align:center;"><%= link_to 'view', project, 
>>> :rel => 'facebox' %></td>
>>>         </tr>
>>>       <% end %>
>>>   </table>
>>>   </div>
>> 
>> What I would do is put that table in a partial, and then have the action 
>> 'search' render said partial, possibly with :locals => { :projects => 
>> @projects } so you can use a local variable 'projects' to create your 
>> table.
>> I do not know if plain updating the way you want to do it works (I don't 
>> mean that I don't think it works - I literally mean I have no idea), so 
>> that's how I'd set it up.

-- 
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to