Re: how to render an action in page.replace_html?

Phlip
2008-03-13T11:32:23Z

Suneeta Km wrote:
> Hi all...
>
>  I have an action show_primary_contacts_edit in ci controller, that
> renders
> 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.

--
   Phlip
   http://assertxpath.rubyforge.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?hl=en
-~----------~----~----~----~------~----~------~--~---