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

  • Home
  • SEARCH
  • 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 8174887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:34:42+00:00 2026-06-06T22:34:42+00:00

What i have: Several references to the same partial but with different locals like

  • 0

What i have:
Several references to the same partial but with different locals like

<%= render :partial => 'link/to/partial', :locals => {:fieldtype => 'textline', :text => object.text} %>
<%= render :partial => 'link/to/partial', :locals => {:fieldtype => 'list', :list => object.list, :header => 'HEADER'} %>

Now _partial.html.erb has the following line:

<%= render :partial => 'link/to/partial/'+fieldtype, :locals => locals %>

What i want:
Obviously :locals => locals does not work. How can i link all the locals to the next partial?

  • 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-06T22:34:44+00:00Added an answer on June 6, 2026 at 10:34 pm

    Just for clarification, you could put all the locals in a hash like this:

    <% my_locals = {:fieldtype => 'textline', :text => object.text} %>
    <%= render :partial => 'link/to/partial', :locals => {:my_locals => my_locals} %>
    

    (Not that it can be confusing that {} are both used for declaring a hash and a block)

    In your partial you would then do this:

    <%= render :partial => 'link/to/partial/'+my_locals[:fieldtype], :locals => {:my_locals => my_locals} %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a scroll view which contains several objects like text fields,labels,switch etc..Now as
I have a C# website. It references several compiled dlls. My dlls need to
In .NET c# 3.5 I have a console application (A) that references several assemblies(X,
I have a solution with several projects. The projects have references to each other
I have a search-method which returns multiple items, each with several child-properties with references
I have several xml files with different node structure. I want to extract xml
I have several HTML elements (buttons) that fire the same JQuery AJAX request. When
I have several different numbers in a group that range in sizes and would
I have a ASP.NET web application that use the same DataContextType to access several
In my solution I have to project using the same references (AxInterop.QTOControlLib.dll, Interop.QTOControlLib.dll 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.