how to render an action in page.replace_html?

Suneeta Km wrote:

Hi all...

I have an action show_primary_contacts_edit in ci controller, that
html. I have another action show_contacts_page in ci controller, that
returns RJS.

The action should render an rhtml page which renders a partial.

I want to replace a div "contacts_div" specified in
show_primary_contacts_edit.rhtml with the action
show_primary_contacts_edit. I wrote the code for this in
show_contact_page.rjs as:

page.replace_html "contacts_div", render(:action =>
'show_primary_contacts_edit'), :object => @contacts

I don't know what the benefit of an .rjs is as a separate file. Just write this into the action that responds to show_contacts - I'm guessing Ajax calls that action:

   render :partial => 'show_contacts', :locals => { :@contacts => @contacts }

That calls a partial named _show_contacts.rhtml.