ruby - Showing two types of "posts" in same view mixed together (Rails) -
i have 2 models...a designs model , products model identical both nested in different models (one nested in collection model , other in assortment model). create product first have create assortment create product in assortment.
i show (in view) of designs , of products mixed sorted date.
how can accomplish this? way have (which weak solution) have 1 page separates two...but tacky , not user friendly.
i know post lean , short if better explanation, please feel free ask.
how this:
things = design.all.to_a.concat product.all.to_a things.sort! {|t1, t2| t1.date <=> t2.date} #or whatever date field called
Comments
Post a Comment