Templates and partials

i´m having something like this:

<%= render(:partial => ‘interview’, :object => @interviews)%>

now, within the view, i´d like to pass the id-parameter to select a
like this (although this code is probably wrong):

<%= render(:partial => ‘interview’, :object => @interviews, :id =>

basically, i need the view to tell the controller which interview to
any idea how to achieve this?

Use :locals:

<%= render(:partial => ‘interview’, :locals => { :id => 1237 })%>

Check the docs on ActionController::Base

how can i access the id (local) within the controller to choose the

What do you mean? You retrieve the right object from your controller
and pass that object to your partial.

As far as I understand:

First the controller is executed by rails
Then the view is rendered
And that’s it

So there will be no way to again execute the controller after
the view has been rendered. This means, no communication from view to
the controller is possible. Only from controller to view. And that’s how
should be. If the decision in the view depends on some user action I
suggest using Ajax. Otherwise I would rethink your problem and solve it
in the controller where logic is supposed to be.

On Fri, 02 Dec 2005 11:12:13 +0100, patrick k
[email protected]

as mentioned before:
basically, i need the view to tell the controller which interview to

well, maybe that´s not possible. maybe i need components.

i already thought it might (and should) be that way.
guess i have to re-think my problem.

thanks for your answer.

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