mixplate
2007-Mar-22 13:44 UTC
how to trim my view? using different models? simple im sure.
hi, i have a view page that display a little information about my models. basically i have 4 different models and all four have some fields in common like timestamp, description, and category. right now i have 4 different view files that do the same.. viewtype1.rhtml for something in @myvariableType1 something.description etc... something.Type1.picture end viewtype2.rhtml for something in @myvariableType2 something.description etc... end etc... is there a way to not have 4 different view files? cant i use class to name or something? thanks -- 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 -~----------~----~----~----~------~----~------~--~---
David Coleman
2007-Mar-22 14:16 UTC
Re: how to trim my view? using different models? simple im s
mixplate wrote:> is there a way to not have 4 different view files? cant i use class to > name or something?you can separate all of your common code into partials. http://api.rubyonrails.com/classes/ActionView/Partials.html -- 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 -~----------~----~----~----~------~----~------~--~---