ruby on rails - show records from two different models using pagination -
I have two models .. My Controller .. My view file If I just use You are paginating each archive, you have to add them first, then the array must be paginated . / P> As you are adding two questions together, it seems that you need to sort the array in the Ruby. video and
youtube_video .. There is a
index page to show both videos in .i. Therefore, I am pointing the page on both the resultet to the add-on .... array of two in the array to show on the index page. For the total pages that I am doing wrong, I know that this is a work, as it works on
ActiveRecord Relationships and
does not occur on ActiveRecord . I also tried the model. Where ... but does not work ... any work on this will be appreciated :)
@ Videos = Video.includes (: user,: reputations, tags, comments) .paginate (: page => params [: page],: per_page => 10). Order ("created_at DESC") @ youtube_videos = YoutubeVideo.includes (: user, tag). Paginated (: page = & gt; parameter [: page],: per_page => 10) .order ("created_at DESC") @ All_videos = @ video + @youtube_videos
looping at ### @all_videos .... and lieutenant; Div class = "page_info text-center" style = "margin-down: 10px" & gt; & Lt ;! - It breaks here - & gt; & Lt;% = page_entries_info @ all_videos% & gt; & Lt; Hour & gt; & Lt ;! - It also breaks down if I remove the above line - & gt; & Lt;% = ajax_will_paginate @ all_videos% & gt; & Lt; / Div & gt;
@videos. .it works, but after the merge .. breaks with any other model .. any ideas?
will need 'will_paginate / array' @videos = Video.includes (: user, reputations, tags, comments) .order ("created_at DESC") @ youtube_videos = YoutubeVideo.includes (: User :: tag) .order ("created_at DESC") @all_videos = (@videos + @youtube_videos) .paginate (: page => parameter [: page],: per_page => 10)
Comments
Post a Comment