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 7826887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T09:36:46+00:00 2026-06-02T09:36:46+00:00

I have 2 models: Subscriber – id – name:string – email:string Submission – id

  • 0

I have 2 models:

Subscriber
  - id
  - name:string
  - email:string

Submission
  - id
  - name:string
  - email:string
  - path:string
  - ip:string

They don’t have any relation.

I’d like to select all rows from subscribers and exclude rows with email address inserted in submission table where url equals ‘some/path’.

What is the most elegant way to do accomplish this with Rails?

  • 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-06-02T09:36:47+00:00Added an answer on June 2, 2026 at 9:36 am

    I dont really get what you mean with: where url equals ‘some/path’
    But i guess you can just add that as an extra condition…

    if you solve it with a normal nested query you get:

     SELECT *  
     FROM subscribers 
     WHERE email NOT IN (Select email FROM Submission)
    

    So in active record this would be:

     subscribers.all(:conditions => ["email NOT IN (SELECT email from Submission)"])
    

    If you dont like to write that nested select query you can also do:

     emails = Submission.all
     subscribers.all(:conditions => ["email not in (?)", emails])
    

    I didn’t test it, but it should be something along these lines.

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

Sidebar

Related Questions

I have two models: class Subscription belongs_to :subscriber, :class_name => User belongs_to :subscribable, :polymorphic
I have models like this: class IdfPracownicy(models.Model): nazwa = models.CharField(max_length=100) class IdfPracaOpinie(models.Model): nazwa =
I have that situation: I have models Item, Region and Country. class Item(models.Model): name
I use flask with flask-peewee and wtfpeewee. So, I have models like that: class
I have two models, A and B, and one light, L. I would like
I have a model which is essentially just a string (django.db.models.CharField). There will only
Here is my scenario: I have three models Subscriber, Subscription, Plan , with has_many
I have a many-to-many relation between users and the channels they subscribe to. But
I have 2 tables namely subscriber and contact. Tables look something like this: subscriber
I have the following models: Topic, UserProfile, UserSubscribedToTopic The last of these looks like

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.