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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T12:43:33+00:00 2026-05-21T12:43:33+00:00

I am pretty new at this, so any help is much appreciated. While building

  • 0

I am pretty new at this, so any help is much appreciated.

While building a tabbed interface I am trying to reuse the same partial and controller and pass a :conditions to a controller to build every tab differently.

@wishes_category = Wish.find :all,
:order => 'id DESC',
:conditions => {:user_id => @current_user.id}

First tab would need something like :category_id=>1 in the controller’s :conditions thus limiting what I show in it.
I am trying to pass this condition to a partial which would use the a pre-limited @wishes_category with :category_id=>1

Thanks!
Naz

==

Based on what Erik said, I then limited the @wishes_category this way
<% if category_id == wish.category_id %> in the partial thus solving the problem

  • 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-21T12:43:33+00:00Added an answer on May 21, 2026 at 12:43 pm

    You can pass local parameters to a partial through its render tag using something like:

    <%= render :partial => 'tab', :locals => {:category_id => 1} %>
    

    This sets a local variable in the partial named category_id equal to 1. In your partial, it would be referenced simply using <%= category_id %>. Now you are able to render the same partial file multiple times in a page with different local variables.

    Of course the variable category_id must exist in the partial before being used or it will throw an error. You can protect against this by checking <% if local_assigns[:category_id] %> first.

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

Sidebar

Related Questions

Im learning lisp and im pretty new at this so i was wondering... if
Ok. So I am pretty new a this. I have a datatable that I
I'm pretty new to the idea of recursion and this is actually my first
So I am pretty new to JQuery and just spent 5 hours getting this
I'm pretty new to my company (2 weeks) and we're starting a new platform
I'm a pretty new C# and .NET developer. I recently created an MMC snapin
I am pretty new to php, but I am learning! I have a simple
I am pretty new to VB.NET - and I'm struggling to convert the signature
I'm pretty new to JSF and the many many related technologies out there. I'm
I'm pretty new to regular expressions. I have a requirement to replace spaces in

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.