user1404536
user1404536

Reputation: 1131

render a view from another controller

I'm trying to render one view (index) from one controller to the view of another controller. index needs to calculate some values in the controller and render the view.

How do I do this?

example: in products/list I have

<%= render :partial=>"admin/index" %>

and in admin_controller:

def index
   @member = something
end

looks like the code in admin/controller never gets executed.

Thank you!

Upvotes: 0

Views: 921

Answers (1)

Hesham
Hesham

Reputation: 2347

Render will just render the view, it won't run the action associated with it.

You have to copy this:

   @member = something

to your products/list action.

Upvotes: 1

Related Questions