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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:25:08+00:00 2026-05-15T03:25:08+00:00

Piggy backing off another question I posted , I have a complex find() that

  • 0

Piggy backing off another question I posted, I have a complex find() that changes whether or not a certain id is nil or not. See here:

if self.id.nil?
  blocks = AppointmentBlock.find(:first,
    :conditions => ['appointment_blocks.employee_id = ? and ' +
                    '(time_slots.start_at between ? and ? or time_slots.end_at between ? and ?)',
    self.employee_id, self.time_slot.start_at, self.time_slot.end_at,
    self.time_slot.start_at, self.time_slot.end_at],
    :joins => 'join time_slots on time_slots.time_slot_role_id = appointment_blocks.id')
else
  blocks = AppointmentBlock.find(:first,
    :conditions => ['appointment_blocks.id != ? and ' +
                    'appointment_blocks.employee_id = ? and ' +
                    '(time_slots.start_at between ? and ? or time_slots.end_at between ? and ?)',
    self.id, self.employee_id, self.time_slot.start_at, self.time_slot.end_at,
    self.time_slot.start_at, self.time_slot.end_at],
    :joins => 'join time_slots on time_slots.time_slot_role_id = appointment_blocks.id')
end

I’m wondering if there is a gem out there that lets me pass in :first and :conditions type stuff as a block of code. I saw ez_where on github but wasn’t sure if it was abandoned or not since its had no activity lately (although that could mean its very solid with no bugs) Any ideas?

  • 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-15T03:25:09+00:00Added an answer on May 15, 2026 at 3:25 am

    You can also have a look at Arel which:

    Arel is a Relational Algebra for Ruby.
    It 1) simplifies the generation
    complex of SQL queries

    The approach is built into Rails 3 as well. Provides really elegant support for building complex chains of scopes and queries.

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

Sidebar

Related Questions

On an embedded type system, I have created a Small Object Allocator that piggy
This question is to piggy back off of a previous one I asked yesterday
This question piggy backs of another question which I raised regarding abusing the IEnumerable
Is there a way I can piggy back sessions to know if the user
I am updating a client site that uses Jetbox CMS v2.1 . I need
I've got a VSTO3 Word addin that makes use of custom ribbons and taskbars,
(I think this is a job for SO and not programmers.SE , please let
I have a class, and I am doing some nifty things with reflection. Now
I try to generically convert user input into either simple or complex types: class
For the last 6 months or so I've been using a 2-way Git mirror

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.