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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:52:04+00:00 2026-06-18T08:52:04+00:00

Im trying to exclude current_user.id from my Tire search results but cannot figure how

  • 0

Im trying to exclude current_user.id from my Tire search results but cannot figure how to pass a param to Tire and use that instead of a fixed value for search.
How could one pass the current_user.id to the model and exclude it in search results?

Activerecord way:

Profile.where("user_id != ?", current_user.id)

My tire search block:

if params['people']
  tire.search(load: true, page: params[:page], per_page: 20, :default_operator => 'AND') do
    query do
      boolean do
        must_not { string 'user_id: 1' } <== this works hardcoded
        must_not { string 'user_id: < instead of 1 user current_user.id pass in true params?' }          
      end
    end
    to_curl
  end
end
  • 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-18T08:52:05+00:00Added an answer on June 18, 2026 at 8:52 am

    Have you tried to use the “imperative style” the README mentions on https://github.com/karmi/tire ? This is a straight quote from the readme:

    search = Tire::Search::Search.new('articles')
    search.query  { string('title:T*') }
    search.filter :terms, :tags => ['ruby']
    search.sort   { by :title, 'desc' }
    search.facet('global-tags') { terms :tags, :global => true }
    # ...
    p search.results
    

    Maybe the “declarative” style folds to much blocks inside each other, and then the context (current_user) is lost. How exactly did you insert the current_user_id in your boolean condition?

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

Sidebar

Related Questions

I'm trying to select all dom elements that have id=mydiv but exclude the ones
I'm trying to exclude a bunch of results from a database SELECT using the
I am trying to exclude gmail's requests from Live Http headers, but I cant
I'm trying to exclude any value from a certain field (table.value) that does not
Doing a simple Squeryl database lookup, but trying to exclude a value. I've tried:
I'm trying to exclude the the email code from the foreach loop, At the
I'm trying to exclude a tag from the wordpress tag cloud by it's slug.
I'm trying to call a stored procedure from EntityFramework which uses Table-value parameter. But
Trying to exclude a piece of code from running on certain pages. I would
Hi basicly i am trying to use the svm from here . It is

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.