I am trying to retrieve two materials database: first source equivalent field of "imported "
(which means we import it from an Excel spreadsheet), and another source! = Imported
(we make it from scratch). Enclosed is my code:
Diif index add_breadcrumb 'projects', Projekts_peth add_breadcrumb @ project.name, @project add_breadcrumb "list # {@ category.display_name} content", project_category_contents_path (@project, @ Series) @contents_imported = Content.of_project (@project) .with_category (@category) .imported.order ( 'contents.created_at asc') @contents_not_imported = Content.of_project (@project) .with_category (@category) .not_imported.order ( 'Contents.created_at desc') @page = params [: page] @contents = @contents_not_imported & lt; & Lt; @contents_imported @q = @ content.search (params [: q]) @content = @ q.result (separate truth). Page (@ page) go.But (20) end @contents_imported = Content.of_project (@project) .with_category (@category) .imported.order ( 'contents.created_at asc') @contents_not_imported = Content.of_project (@project). With_category (@category) .not_imported.order ('contents.created_at desc')
And I want to add two results before showing it:
@contents = @contents_not_imported & lt; & Lt; @contents_imported
but it does not work How can I do this?
If there are both arrays and objects of the same type then you can Results = RR1 | Arr1
This also removes the duplicate like the Boolean Union in your case @contents = @contents_not_imported | @contents_imported
No comments:
Post a Comment