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 standards rendered, there is an error saying that var or method
not defined. Any thoughts about the problem? thanks.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Colin Law at Jan 24, 2012 at 1:29 pm

    On 24 January 2012 03:20, emc_lab wrote:
    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 standards rendered, there is an error saying that var or method
    not defined. Any thoughts about the problem? thanks.
    Can you show us the error please?

    Colin

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Cj at Apr 11, 2012 at 2:17 am
    I have this same issue :/
    On Monday, January 23, 2012 9:20:37 PM UTC-6, emc_lab wrote:

    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 standards rendered, there is an error saying that var or method
    not defined. Any thoughts about the problem? thanks.
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/pL_m7J8GWE4J.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Colin Law at Apr 11, 2012 at 8:19 am

    On 11 April 2012 00:39, cj wrote:
    I have this same issue :/
    Since the OP did not reply I assume he discovered a silly error. The
    response to him applies to yourself, however, you must show the full
    error message (copy/paste it here, do not retype in case of typo
    errors) and post the relevant section of code where the error is
    arising and the render call if it is a similar problem to the OP.

    Colin
    On Monday, January 23, 2012 9:20:37 PM UTC-6, emc_lab wrote:

    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 standards rendered, there is an error saying that var or method
    not defined. Any thoughts about the problem? thanks.
    --
    You received this message because you are subscribed to the Google Groups
    "Ruby on Rails: Talk" group.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/rubyonrails-talk/-/pL_m7J8GWE4J.

    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/rubyonrails-talk?hl=en.


    --
    gplus.to/clanlaw

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Fred Ballard at Apr 11, 2012 at 6:58 pm
    It also helps to show the simplest possible case that triggers the error.
    Not only does it make things easier for people trying help you, you often
    find the error yourself in the course of simplifying.

    On Wed, Apr 11, 2012 at 03:18, Colin Law wrote:
    On 11 April 2012 00:39, cj wrote:
    I have this same issue :/
    Since the OP did not reply I assume he discovered a silly error. The
    response to him applies to yourself, however, you must show the full
    error message (copy/paste it here, do not retype in case of typo
    errors) and post the relevant section of code where the error is
    arising and the render call if it is a similar problem to the OP.

    Colin
    On Monday, January 23, 2012 9:20:37 PM UTC-6, emc_lab wrote:

    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 standards rendered, there is an error saying that var or method
    not defined. Any thoughts about the problem? thanks.
    --
    You received this message because you are subscribed to the Google Groups
    "Ruby on Rails: Talk" group.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/rubyonrails-talk/-/pL_m7J8GWE4J.

    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/rubyonrails-talk?hl=en.


    --
    gplus.to/clanlaw

    --
    You received this message because you are subscribed to the Google Groups
    "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/rubyonrails-talk?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedJan 24, '12 at 12:18p
activeApr 11, '12 at 6:58p
posts5
users4
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2021 Grokbase