2

I have two controllers Players and Teams

I want to render a partial view from a team view that belongs to the Players_controller. I have the problem that I can't reach the instance variables from the Players_controller.

Do I need to define these variables again in my Team_controller?

2
  • are players and teams related via ActiveRecord? Commented Apr 12, 2012 at 11:33
  • Can you show a bit of code? The controller action and views would help. Commented Apr 12, 2012 at 12:01

1 Answer 1

4

Have a look at this link. I think what you are looking for is either

<%= render :partial => "customer", :object => @new_customer %>

or something like

<%= render :partial => "form", :locals => { :zone => @zone } %>
Sign up to request clarification or add additional context in comments.

1 Comment

I made a change to your answer before realizing that I just wasn't aware of the :object option when rendering partials. I reverted the change, sorry about that. And thanks for teaching me something new. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.