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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:31:11+00:00 2026-05-28T19:31:11+00:00

Here is code in form.html.erb for partial view. Local var :sid was defined as

  • 0

Here is code in form.html.erb for partial view. Local var :sid was defined as the id of the record and it should be passed into the partial view standards.html.erb as a local var.

  <% @rfq.standards.each do |r| %>  
    <p><%= render :partial => 'standards', :locals => { :f => f, :sid => r.id } %></p>
  <% end %>

Here is the standards partial view:

  <%= f.association :standards, :collection => Standard.active_std.all(:order => 'name'), :label_method => :name, :value_method => :id, 
                                :prompt => "Choose std", :label => "standard:", :include_blank => true, :selected => :sid %>

When rendered, standards partial view should render a collection of standards with sid selected. However the code above does not select the standards at all. Tried sid (string) :selected => sid. This causes error saying that sid was not defined.

My question is what’s the right way to pass and retrieve a local var in view? Thanks so much.

  • 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-28T19:31:12+00:00Added an answer on May 28, 2026 at 7:31 pm

    The problem was caused by the partial standards were not called in each and every place with exactly the same format. In one method (not shown here), the partial standards was called like: render :partial => standards, :locals => {:f => f}. After adding :sid => 0 as render :partial => standards, :locals => {:f => f, :sid => 0}, the sid here is passed in successfully.

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

Sidebar

Related Questions

Here's my code for registerFormOne.php : <html> <head> <title>Registration Form - 1 of 2</title>
Here is my main page code: <form><iframe name=iframe_pic src=iframe.html></iframe></form> Here is my iframe.html: <script
Here's the call in the application.html.erb file: <%= render :partial => 'tasks/_new' %> Here's
Here is my code for my edit.html.erb: <script src=http://js.nicedit.com/nicEdit-latest.js type=text/javascript></script> <script type=text/javascript>bkLib.onDomLoaded(nicEditors.allTextAreas);</script> <div class=row>
Here is the relevant code from views/products/edit.html.erb : <%= form_for(:product, :url => {:action =>
Here is a piece of code in edit.html.erb which does not work. The purpose
Here is a code form a PHP+MySQL book I am reading and I am
I'm not sure what the problem is here, I've inherited some code form Zend
Here is the input form code <tr valign=top> <td align=right class=innertablestyle><font class=normal><strong>Homepage</strong></font></td> <td>&nbsp;</td> <td>
Here's my code: if Request.Form(authorize) <> and request.form(delete) <> true then post_ids = Request.form(authorize)

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.