Hey all,

I'm working on a project right now, and one of the models is
Company....  simple regular company.

Now I've created some AJAX type searches in my project that rely on
searching on companies, which I use the INDEX action of
company_controller and pass a parameter which returns my companies,
using an RJS file I do my AJAX... this is what index.js.rjs looks like
for my company_controller.

page.replace_html 'results', :partial => '/search_results'
page.visual_effect :highlight, 'Flash'

Simple...  now where I'm confusing myself is that I use the index
action to generate a list of companies several times... but the way I
have ti setup, I'm foreced to render search_results each time...  I'm
curious what you guys think the best way to get around this is...

putting conditions in the RJS?

if params[:flag] == red
     page.replace_html 'results', :partial => '/
search_results_no_widgets'
else
   page.replace_html 'results', :partial => '/
search_lists_with_widgets'
end

or is the better solution to create a "format" for each one and add
another format to the index action...

  respond_to do |format|
      format.html # index.html.erb
      format.js #index.js.erb ( widgets )
      format.js2 #index.js2.rjs ( no widgets )
      format.xml  { render :xml => @companies }
  end

Or is the better solution something else entirely?

Any input on this is appreciated... Thank you.
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to