Luca Scaljery
2006-Dec-14 21:16 UTC
import .rb files in other .rb files (for the ''view'')
Hi All I have a complex structure (a lot of <div>''s) which occures in a couple of views. I think I red somewhere that it is possible to put this structure in a seperate .rb file, which can then be included into the other (.rb) files. Can someone point me into the right direction of how to do this ?? Thnx a lot LuCa -- 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 -~----------~----~----~----~------~----~------~--~---
Alex Wayne
2006-Dec-15 05:35 UTC
Re: import .rb files in other .rb files (for the ''view'')
Luca Scaljery wrote:> Hi All > > > I have a complex structure (a lot of <div>''s) which occures in a couple > of views. > > I think I red somewhere that it is possible to put this structure in a > seperate .rb file, which can then be included into the other (.rb) > files. > > Can someone point me into the right direction of how to do this ?? > > Thnx a lot > LuCaPartials are your friend. #app/views/foo/index.rhtml <% @items.each do |item| %> <%= render :partial => ''item'', :locals => {:item => item} %> <% end %> #app/views/foo/_item.rhtml <div class="item"> <h1>Item #<%= item.id %></h1> <%= textilize(item.description) %> </div> -- 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 -~----------~----~----~----~------~----~------~--~---