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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:34:09+00:00 2026-05-27T01:34:09+00:00

I have two tables: projects and supplies. Projects have many supplies, like this: has_many

  • 0

I have two tables: projects and supplies. Projects have many supplies, like this:

has_many :supplies, :through => :project_supplies, :foreign_key => :supply_id

One thing that I am trying to do is to select projects based on an array of supply id’s. I can do this in the rails console fairly easily with the following:

Project.find(:all, :joins => :supplies, :conditions => {:supplies => {:id => [17,18]}})

Being somewhat of a Rails noob, I can’t seem to figure out how to go about sending that array as a parameter, and / or serializing it on the back-end.

I’m trying to do this “GET http://0.0.0.0:3000/projects?supply_ids=%5B17,18%5D” in a way that rails understands.

Is that how I’m supposed to send the array? If so, how do I get that into the conditions clause in array form?

I should also mention that I’m using Rails 3.1 and backbone.js. The get request will come from the backbone fetch() function which accepts a “data” option just like $.ajax. I already have the array built on the front-end.

To summarize, my question is this: What exactly should go into the JavaScript data object attribute, and how do I wire that up to the controller model’s find function as shown above?

Thanks in advance.

  • 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-27T01:34:10+00:00Added an answer on May 27, 2026 at 1:34 am

    You have bad format of array in URL string:
    Use:

    GET http://0.0.0.0:3000/projects?supply_ids[]=17&supply_ids[]=18
    

    Related topic:
    passing arrays as url parameter

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

Sidebar

Related Questions

I have two tables: one called Projects, and another called Documents (projects has many
I have two tables: projects and user_licenses . I'd like to grab the entire
I have two simple tables: Projects and SubProjects which I'd like to print every
I have two tables: projects and tasks. A project consists of tasks. I want
I have two tables, one is a list of songs. The other is a
I have a database that has two tables, one of which contains a foreign
I have two tables, projects and archive with identical columns. As you understand, I
I have problem when I tried to update two tables in one Store Procedure
I have very simple form along with two database tables. In this form is
Hi all i have two tables Projects ---------- ProjectID|ProjectNAme 1 |asdasd 2 |adas 3

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.