Stuart Wade
2006-Aug-18 14:18 UTC
[Rails] controller is to app.rb ; view is to layout folder ; rjs template is to ??
any help with this analogy? i have an rjs template that goes along with a method i have in application.rb and the functionality will be used from many diff controllers (the method take a tag as param to accomplish some AJAX acrobatics).. just trying to stay DRY here. is there no other way other than sticking the same rjs template in each view folder that uses this functionality? i guess i could do some inline rjs in the method, but depending on where this goes that could get VERY messy. thanks in advance! stuart
Jim Kane
2006-Aug-18 14:36 UTC
[Rails] controller is to app.rb ; view is to layout folder ; rjs template is to ??
On 8/18/06, Stuart Wade <teflon_of_armada@hotmail.com> wrote:> > > any help with this analogy? i have an rjs template that goes along with a > method > i have in application.rb and the functionality will be used from many diff > controllers (the method take a tag as param to accomplish some AJAX > acrobatics).. just trying to stay DRY here. is there no other way other > than > sticking the same rjs template in each view folder that uses this > functionality? > i guess i could do some inline rjs in the method, but depending on where > this > goes that could get VERY messy. > > thanks in advance! > stuartThere''s plenty of precedent for sharing view templates, and RJS is no different. The idiomatic way is to make a folder ''app/views/shared'' and stick your template in there. Then, when you''re rendering you add :template => ''shared/foo'' to the options. -- Jim Kane fastjames@gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060818/103f7453/attachment.html