> I want to render a partial from two different views (class/index;
> cohort/index) in order to iterate (?) through the pupils model using
> _pupil.html.erb (in the pupils/views directory)
>
> class has many pupils
>
> cohort has many pupils
>
> pupil belongs to class
> pupil belongs to cohort
>
> It works well, and the _pupil.html.erb partial is rendered correctly
> from both views.
>
> * But, and this is the thing, I want the pupil partial to be slightly
> different in each case i.e. when it's called from cohort/index I want
> to display the pupil data in a table, but not when it's rendered from
> class/index.
>
> How do I go about having two _pupil.html.erb partials without breaking
> links between views/controllers/models please?

Why wouldn't you just move views/pupils/_pupil.html.erb into views/ 
class/_pupil.html.erb and views/cohort/_pupil.html.erb and change them  
to do what you want?  Then update the render :partial calls from the  
two calling files to look to their own version?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to