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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:21:50+00:00 2026-06-18T04:21:50+00:00

I am working with a rails app and have begun to work on a

  • 0

I am working with a rails app and have begun to work on a search function using metasearch but I am having troubles getting the correct method for the search.

For example I have a model (Proposal) that has a field cost.

..model/proposal.rb

class Proposal < ActiveRecord::Base
belongs_to :user
has_many :users, :through => :invitations
attr_accessible :cost, :user_id

For which this code works fine with meta search

..views/homes/live_requests.html.erb

<%= form_for @search, :url => "/live_requests", :html => {:method => :get} do |
<%= f.label :cost_greater_than %>
<%= f.text_field :cost_greater_than %><br />
<!-- etc... -->
<%= f.submit %>

Yet with a more complicated association I can not manage to get the meta search path correct.

I am trying to search over:

Proposal.last.user.suburb.name #Returns the name of the suburb as expected

I have tried many associations but cannot find the right one.

Proposal has a user_id field which maps to user
So Proposal.user returns a User
User then has a suburb_id which returns a suburb
Suburb has a field called name which returns a string

How would I work this into a metasearch form?

<%= f.text_field :user_user_suburb_name %>
or
<%= f.text_field :user_id_suburb_id_name %>

I cannot come to a solid conclusion.

Thanks for your help 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-06-18T04:21:51+00:00Added an answer on June 18, 2026 at 4:21 am

    Was simply following the correct names as declared by the models.

    Ie. in the model above, ensuring that it was User, not users etc.

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

Sidebar

Related Questions

I have a simple search working in my rails app, but it only searches
I have rails app which are working perfectly in the local computer. But when
I have a Ruby on Rails app that I'm working on and I'm having
I have a working private-beta Rails app on mydomain.com. All the routes work. However,
I have jquery working on my Rails app using the gem 'jquery-rails' . I
In my Ruby on Rails app I have set up OAuth to work using
I'm working on a rails 3.2 app and have started getting these errors relating
Have a working rails app on development but issue deployed. Was recently working but
I'm working on a Rails app using CanCan for RBAC and I only have
I have a fantasy football league rails app that was working last year and

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.