1. Im starting to get tired of putting all the information on my layouts for links to my pages. I was wondering if ruby on rails had an include function like php where I could put the links in one file and put one line on each layout. 2. I would also like to know how you get ruby to refresh a page using a button if anyone knows. -- Posted via http://www.ruby-forum.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 -~----------~----~----~----~------~----~------~--~---
1) use partials. place your menu/links in a file named: _menu.html.erb (the underscore at the beginning makes it a partial) and render it in your view/layout with: <%= render :partial => "menu %> -- Posted via http://www.ruby-forum.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 -~----------~----~----~----~------~----~------~--~---
Alan Red wrote:> Im starting to get tired of putting all the information on my layouts > for links to my pages. I was wondering if ruby on rails had an include > function like php where I could put the links in one file and put one > line on each layout.Also, if your layouts are the same, or very similar, then you can just use a single layout (app/views/layouts/application.html.erb) and allow for any differences from there. If you use this approach, then you will have to remove the individual controller layouts as they will override the application default one.> I would also like to know how you get ruby to refresh a page using a > button if anyone knows.The user already has a refresh page button on their browser, however if you really need this, then you can add something like this, say to your layout: <%= button_to "Refresh", :controller => controller.controller_name, :action => controller.action_name %> However I haven''t checked what happens to your params through this call, so you may need to do something clever with them. -- Posted via http://www.ruby-forum.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 -~----------~----~----~----~------~----~------~--~---
Thanks guys, this really helps. Didn''t think of using a partial, will make things easier. -- Posted via http://www.ruby-forum.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 -~----------~----~----~----~------~----~------~--~---
ESPNDev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Mar-20 22:55 UTC
Re: ruby have include like php and refresh?
You can also just use <input type="button" value="Refresh" onclick="reload();" /> On Mar 19, 8:30 am, Alan Red <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Thanks guys, this really helps. Didn''t think of using a partial, will > make things easier. > > -- > Posted viahttp://www.ruby-forum.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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---