Rendering Partials with contextual_views turned on.
Reported by Brian McManus | June 9th, 2009 @ 04:59 PM
I found it a bit unintuitive where the partials needed to be when I turned on contextual_views. Examples:
render @models # Partial _model.html.haml needed to be in views/models/ to be found.
render :partial => "form", :object => f # Partial _form.html.haml needed to be in the context subfolder e.g. views/models/root
I'm not sure why there's a discrepancy here.
Comments and changes to this ticket
- State changed from new to open
Take Resourcelogic away and Rails does this for all of the controller sub folders. But when you jump down into a sub folder under each controller rails still looks for the template in the controller subfolder, not the context sub folder. I figured it was more intuitive that if you were in users/admin and called the "user" partial it would look for users/admin/user and not users/user. Does that make sense?
I guess what Resourcelogic could do is check for the more specific and then check for the template a level above that.
What do you think?
I guess I'm confused still. I was in the same subfolder (e.g. users/admin) for both renders. In one case it expected the partial to be in users/admin. In the other it expected it to be in users/. I agree that it should have been looking in users/admin but for some reason it did not when I used the new (2.3) render @users version.