Ruby: merge results of two methods from a class -
I found a class called TemplateResources which has two methods like this: The results are said in a view like this: I should see combined results displayed in the view. I thought Maybe: and compared to this view:
def components @ template.tconents end def custom_articles components + = @ user.custom_articles if @ user.custom_articles.present? End
<% @ template_resources.oconents.each do | Articles | & Gt%;
+ = would do this, but it does not seem that anybody knows how to join the results of those two methods?
def components @ template.tconents end DEF custom_ articles @ User.custom_articles || [] End DEF all_articles components + custom_articles end
<% @ template_resources.all_articles.each do | Articles | & Gt%;
Comments
Post a Comment