Can a action view invoke a methode of a controller then display its results

S

sayoyo

Hi,

Can an action view (a template) invoke a methode of a controller, then
display the results of the methode at the same template?

like:
if actionTwo return a simple string "xyz123"

and the action view looks like this:

<body>
abcde
<%= render:)action => :actionTwo) %>
</body>

Should the result html be
abcde
xyz123

Thanks you very much

Sayoyo
 
A

Andrew Stone

------=_Part_35287_4731880.1131470564037
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

You can call a method on the controller by:

@controller.method_call

so

<%=3D render:)action =3D> @controller.actionTwo) %>

I think that will work. Not tested though.

-andy
 
S

sayoyo

Hi,

I have tried the @controller.actionTwo, but it doesn't work. I got the
following msg error:

You have a nil object when you didn't expect it!
The error occured while evaluating nil.actionTwo

I think, it doesn't recognize the contorller....

Sayoyo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top