Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6148407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:16:31+00:00 2026-05-23T19:16:31+00:00

I have 2 multi selectors in extJS (respondents groups and jsut respondents). Erery respondent

  • 0

I have 2 multi selectors in extJS (respondents groups and jsut respondents). Erery respondent have a group (ONLY 1).

here, how i selected my ids …

I get respondent_group id, for example = 1

  respondent_ids       = params[:selected_respondents].split(/,/).collect {|r| r.to_i}

here i get respondents ids: 3,4,1

  respondent_pure_ids  = params[:selected_alone_respondents].split(/,/).collect {|r| r.to_i}

here i find respondents in group (for example i have 10 groups, every group has 1-3 respondents).

  respondents       = Respondent.find(:all, :conditions => ["respondent_group_id in (?) AND id NOT IN (?)", respondent_ids, session[:user].id]) 

I find respondents .

  respondents_alone = Respondent.find(:all, :conditions => ["id in (?) AND id NOT IN (?)", respondent_pure_ids, session[:user].id]) 

here i found respondents (i find id where respondent_group = ?) and send them email.

        respondents.each do |r|
            Notifier.deliver_inquiry_notification() 
        end

What I want?
I get respondents and respondents_alone id’s.

For example respondents = 3 , 4 , 6
respondents_ alone = 3, 5, 6, 8

I have 3 and 6 ids in both. I dont want to dublicate my data . How to check: if respondents ids DOES NOT equals respondent_alone ids I SEND EMAIL else error!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T19:16:31+00:00Added an answer on May 23, 2026 at 7:16 pm

    You can use ruby array arithmetic to get the difference between both arrays or to get every entry only once:

    a = [3, 4, 6]
    b = [3, 5, 6, 8]
    a - b # [4] (only a without any element of b, difference)
    b - a # [5, 8] (only b without any element of a, difference)
    a | b # [3, 4, 6, 5, 8] (complete set of all ids, union)
    a & b # [3, 6] (ids same in both arrays, intersection)
    

    With this you can check if some ids are only in one array or in both, e.g. difference is empty or a|b==a&b => both are equal

    cf. http://www.ruby-doc.org/core/classes/Array.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a multi-line text view that can get quite large. When the user
We have multi-part install that needs a reboot to continue. We added a RunOnce
I'm using 'rails3-jquery-autocomplete' gem, but it doesn't have multi column search, but there is
I have a multi-array stored in a SESSION I loop through the data in
I have a multi-step order form built in this manner: Step 1: Choose category
I have a multi-xaml metro app. I want to switch between xaml by button
I have: Textbox(Multi-line) Panel Different controls inside panel (buttons,textbox) Scenario: I need to add
I have a multi view application with individual UIViewControllers and xibs. I have one
I have a multi-dimensional array, which basically consists of one sub-array for each year.
I have a multi-dimensional array, no problem. How do I interrogator one of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.