aktxyz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jan-25 23:52 UTC
render .rhtmlx if present, otherwise render .rhtml
We have a product where our customer is "allowed" to make minor changes to the .rhtml views. Obviously, this can be an issue when updating the software, as changes need to be merged in. Also, sometimes the customer wants to back out there change but no longer has the original file. SOOO.... I''d like to tell them - if you want to change a .rhtml file - just copy it to .rhtmlx and change away Then rails will pick up the .rhtmlx if present, otherwise will render the normal .rhtml Any idea of a good/easy way to do this ? -- THanks --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 1/25/07, aktxyz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <aktxyz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > We have a product where our customer is "allowed" to make minor changes > to the .rhtml views. > > Obviously, this can be an issue when updating the software, as changes > need to be merged in. Also, sometimes the customer wants to back out > there change but no longer has the original file. > > > SOOO.... > > I''d like to tell them > - if you want to change a .rhtml file > - just copy it to .rhtmlx and change away > > Then rails will pick up the .rhtmlx if present, otherwise will render > the normal .rhtml > > Any idea of a good/easy way to do this ?No clue if this works, but it''s an idea from looking at ActionView for a few minutes..... path = "show" if template_exists?(path, :rhtmlx) render :action => "#{path}.rhtmlx" else render :action => path end Look at how ActionView picks which template to render for further reference: http://dev.rubyonrails.org/browser/trunk/actionpack/lib/action_view/base.rb -- Rick Olson http://weblog.techno-weenie.net http://mephistoblog.com --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I''m not really sure on this, but I''ve been reading up on RESTful stuff lately and this seems like it could be a great use for the respond_to? example here: http://weblog.rubyonrails.org/2007/1/19/rails-1-2-rest-admiration-http-lovefest-and-utf-8-celebrations On Jan 26, 9:35 pm, "Rick Olson" <technowee...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 1/25/07, akt...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <akt...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > We have a product where our customer is "allowed" to make minor changes > > to the .rhtml views. > > > Obviously, this can be an issue when updating the software, as changes > > need to be merged in. Also, sometimes the customer wants to back out > > there change but no longer has the original file. > > > SOOO.... > > > I''d like to tell them > > - if you want to change a .rhtml file > > - just copy it to .rhtmlx and change away > > > Then rails will pick up the .rhtmlx if present, otherwise will render > > the normal .rhtml > > > Any idea of a good/easy way to do this ? > > No clue if this works, but it''s an idea from looking at ActionView for > a few minutes..... > > path = "show" > if template_exists?(path, :rhtmlx) > render :action => "#{path}.rhtmlx" > else > render :action => path > end > > Look at how ActionView picks which template to render for further > reference:http://dev.rubyonrails.org/browser/trunk/actionpack/lib/action_view/b... > > -- > Rick Olsonhttp://weblog.techno-weenie.nethttp://mephistoblog.com--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---