Component using

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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs