Forum: Ruby on Rails Component using

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Mikhail M. TSaplin (Guest)
on 2006-04-15 09:19
(Received via mailing list)
Hello all, I have a simple task. I need to create a guestbook component,
render it from the main application.
The guestbook have the following controller actions:
viewMessages  - simply shows messages from model
addMessage - generates form that accept message text, username,
password. The
form points to saveMessage action.
saveMessage - receives data from addMessage action.

On the main application i have application.rhtml layout, and template
renders viewMessages and addMessages actions from guestbook component:

<%= render_component(:controller => "hguestbook/GuestBook", :action =>
"viewMessages") %>
<%= session[:addMessageReturnController] = '/Main'
    session[:addMessageReturnAction] = 'guestBook'
    render_component(:controller => "hguestbook/GuestBook", :action =>

For the return point from addMessage i use following lines (see rhtml
session[:addMessageReturnController] = '/Main'
session[:addMessageReturnAction] = 'guestBook'

Is this approach right or maybe you have another one, more prettier?
And if i need to display some another actions from component,
what "layout path" should i use to render with application.rhtml
from the main application. (render :layout => 'application.rhtml path')
This topic is locked and can not be replied to.