Component using


#1

Hello all, I have a simple task. I need to create a guestbook component,
and
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
that
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 =>
“addMessage”)
%>

For the return point from addMessage i use following lines (see rhtml
above):
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’)