How to trim my view? using different models? simple im sure


#1

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


#2

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