|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Rails view search path
I'd like to somehow change the view serach path in Rails such that when a view like say _show.rhtml is requested it first looks in path x, then y and finally z.
This mechanism would allow me to more properly subclass controllers in that I can also inherit or override the views associated with the super controller. |
|
#2
|
||||
|
||||
|
Look into editing the config/routes.rb file.
__________________
Up the Irons What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home. "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest Down with Sharon Osbourne Puzzle of the Month solved by sizeablegrin, etienne141 and L7Sqr, superior C/C++ programmers of the month |
|
#3
|
|||
|
|||
|
Quote:
It seems you don't understand the problem. The routes.rb file is of no use to accomplish this. Consider controller B which inherits from controller A. Both controllers implement a method “show”. A::show renders the template show.rhtml which in turn renders embedded templates show_part1.rhtml and show_part2.rhtml. Ideally, I should now be able to implement my own versions of any or none of these view templates in controller B. The idea is that any view implemented for B will override the view implemented for A. In a nutshell, what I really want is to change the Rails view lookup path. Controller B would simply append Controller A’s view path to the Rails view lookup path. |
|
#4
|
|||
|
|||
|
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Ruby Programming > Rails view search path |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|