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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:00:23+00:00 2026-05-25T06:00:23+00:00

I have a partial _new_user_form.html.erb <%= form_for(@user, :remote => true, :html => {:id =>

  • 0

I have a partial _new_user_form.html.erb

<%= form_for(@user, :remote => true, :html => {:id => 'new_user_form'}) do |f|%>
  <strong><%= :form_text %></strong>
  <%= f.text_field :email, :placeholder =>  get_placeholder_text(@board), :size => "30" %>
  <%= hidden_field_tag :role, role %>
  <%=f.submit "SAVE", :class => "button-small" %>
<% end %>

In the show.rb I want to use it and pass in some partial variables as follows:

<%= render  'users/new_user_form', :locals=> {:role => "Celebrant" } %>

However I get this error:

undefined local variable or method `role' for #<#<Class:0x00000103d5e8b0>:0x00000103d5b930>

I read the documents about passing in locals and this seems correct. What am I doing wrong?

  • 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-25T06:00:23+00:00Added an answer on May 25, 2026 at 6:00 am

    You’re combining the short and long forms. Either of these are correct (identical):

    render 'my_partial', :foo => 'bar'
    
    render :partial => 'my_partial', :locals => { :foo => 'bar' }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this view: new.html.haml %h1 New account - form_for @user do |f| =
I have this form in a partial: <%= form_for current_user.relationships.build(:followed_id => @profile.user.id) do |f|
I have a partial view where I render, if the user has choosen an
I have the following form with Formtastic: = semantic_form_for @user, :url=> url_for(register_path), :html =>
I'm receiving NoMethodError in Users#new after adding the partial app/views/shared/_error_messages.html.erb Showing /Users/gjb/Sites/rails_projects/sample_app/app/views/shared/_error_messages.html.erb where line
I have a strong typed view model and a MetaData partial class which has
Anyone knows if is possible to have partial class definition on C++ ? Something
I want to program something in both C# and F#. I have partial classes
I have a partial that renders a select box using the following method: <%=
I have this partial code: if ($getRecords = $con->prepare(SELECT * FROM AUCTIONS WHERE ARTICLE_NO

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.